Created
July 26, 2013 14:08
-
-
Save kascote/6089142 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -ex | |
### configuration | |
PKGS_TO_ADD="$PKGS_TO_ADD curl git etckeeper python-software-properties" | |
PKGS_TO_REMOVE="$PKGS_TO_REMOVE geoip-database popularity-contest" | |
PKGS_TO_REMOVE="$PKGS_TO_REMOVE pppoeconf pppconfig ppp" | |
PKGS_TO_REMOVE="$PKGS_TO_REMOVE ubuntu-standard memtest86+" # warning: be careful about what you remove after this | |
KERNEL_MODULES_TO_BLACKLIST="$KERNEL_MODULES_TO_BLACKLIST joydev gameport" | |
KERNEL_MODULES_TO_BLACKLIST="$KERNEL_MODULES_TO_BLACKLIST btusb bluetooth" | |
KERNEL_MODULES_TO_BLACKLIST="$KERNEL_MODULES_TO_BLACKLIST shpchp" | |
MINIFY_SETUP_ETCKEEPER='sed -i '\''s/^#\(VCS="git"\)/&/;s/^VCS="bzr"/#&/'\'' /etc/etckeeper/etckeeper.conf && etckeeper init && etckeeper commit "initial"' | |
### configuration | |
# rerun as sudo | |
if [ $UID != 0 ]; then | |
sudo sh -c "exec $0 \"$@\"" | |
fi | |
if [ -n "$PKGS_TO_ADD" ]; then | |
echo Installing $PKGS_TO_ADD | |
apt-get install -y $PKGS_TO_ADD | |
fi | |
if [ -n "$PKGS_TO_REMOVE" ]; then | |
echo Removing $PKGS_TO_REMOVE | |
dpkg -P $PKGS_TO_REMOVE >/dev/null 2>&1 | |
fi | |
if [ -n "$KERNEL_MODULES_TO_BLACKLIST" ]; then | |
BLACKLIST=/etc/modprobe.d/blacklist-minify.conf | |
echo "# Automatically generated by ubuntu_minify.sh" > $BLACKLIST | |
for MODULE in $KERNEL_MODULES_TO_BLACKLIST; do | |
echo Blacklisted kernel module $MODULE | |
echo blacklist $MODULE >> $BLACKLIST | |
done | |
fi | |
for SETUP in `env | grep '^MINIFY_SETUP_'`; do | |
$SETUP | |
done | |
apt-get autoremove -y | |
echo 'Type "reboot" to complete the process' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment