Skip to content

Instantly share code, notes, and snippets.

@Akkiesoft
Last active January 15, 2020 16:55
Show Gist options
  • Save Akkiesoft/9873563 to your computer and use it in GitHub Desktop.
Save Akkiesoft/9873563 to your computer and use it in GitHub Desktop.
コンパクトなRaspbianを作るやつをベースに自己流にアレンジしたもの。Raspbianが500MBちょいのディストリに変身します。NOOBS1.3.10のRaspbianに対応。
#/bin/bash
# コンパクトなRaspbianを作るやつをベースに自己流にアレンジしたもの
#
# ベース: http://www.cnx-software.com/2012/07/31/84-mb-minimal-raspbian-armhf-image-for-raspberry-pi/
# 前のバージョン: https://gist.github.com/Akkiesoft/5426660
sudo apt-get update
# if you want remove Desktop, Uncomment below 2 lines.
#rm -rf python_games ocr_pi.png Desktop/*.desktop
#XPKGS='x11-common xdg-utils gnome-themes-standard-data minecraft-pi epiphany-browser dillo midori penguinspuzzle lxde lxde-common lxde-icon-theme xkb-data xpdf fonts-freefont-ttf x2x '`sudo dpkg --get-selections | grep -v "deinstall" | grep x11 | sed s/install//`
DOCS='libraspberrypi-doc manpages debian-reference-en debian-reference-common'
GCC='gcc-4.5-base:armhf gcc-4.6-base:armhf gcc-4.7-base:armhf'
DEV=`sudo dpkg --get-selections | grep "\-dev" | grep -v "deinstall" | sed s/install//`
MEDIA='omxplayer '`sudo dpkg --get-selections | grep -v "deinstall" | grep sound | sed s/install//`
PYTHON='python3 python3-minimal '`sudo dpkg --get-selections | grep -v "deinstall" | grep python | sed s/install//`
JAVA='java-common oracle-java7-jdk java-common oracle-java8-jdk'
LEARNING='scratch squeak-vm squeak-plugins-scratch supercollider sonic-pi wolfram-engine'
sudo apt-get remove $XPKGS $DOCS $GCC $DEV $MEDIA $PYTHON $JAVA $LEARNING
# Replace OpenSSH to dropbear (Keep openssh-client) if you want.
#sudo apt-get remove openssh-server
#sudo apt-get install -y dropbear
# Run autoremove, upgrade and clean cache.
sudo apt-get autoremove -y
sudo apt-get upgrade -y
sudo apt-get clean
# Regenerate Swap
sudo swapoff -a
cd /var
sudo dd if=/dev/zero of=swap bs=1M count=100
# Clear logs
cd /var/log/
sudo rm `find . -type f`
history -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment