#!/bin/bash apt-get remove dphys-swapfile apt-get install busybox-syslogd; dpkg --purge rsyslog sed -i 's/$/ fastboot noswap ro/' /boot/cmdline.txt rm -rf /var/lib/dhcp/ /var/run /var/spool /var/lock /etc/resolv.conf ln -s /tmp /var/lib/dhcp ln -s /tmp /var/run ln -s /tmp /var/spool ln -s /tmp /var/lock touch /tmp/dhcpcd.resolv.conf; ln -s /tmp/dhcpcd.resolv.conf /etc/resolv.conf rm /var/lib/systemd/random-seed ln -s /tmp/random-seed /var/lib/systemd/random-seed sed -i '21iExecStartPre=/bin/echo "" >/tmp/random-seed' /lib/systemd/system/systemd-random-seed.service systemctl daemon-reload sed -i '7i\ \ mount -o remount,rw /' /etc/cron.hourly/fake-hwclock sed -i '9i\ \ mount -o remount,ro /' /etc/cron.hourly/fake-hwclock insserv -r bootlogs; sed -i 's/boot vfat defaults,errors=remount-ro,rw,owner,flush,umask=000 0 2/boot vfat defaults,errors=remount-ro,ro,owner,flush,umask=000 0 2/' /etc/fstab sed -i 's/ext4 errors=remount-ro,rw,noatime,nodiratime 0 1/ext4 errors=remount-ro,ro,noatime,nodiratime 0 1/' /etc/fstab echo "tmpfs /var/log tmpfs nodev,nosuid,mode=1777 0 0" >> /etc/fstab echo "tmpfs /var/tmp tmpfs nodev,nosuid,mode=1777 0 0" >> /etc/fstab # set variable identifying the filesystem you work in (used in the prompt below) set_bash_prompt(){ fs_mode=$(mount | sed -n -e "s/^\/dev\/.* on \/ .*(\(r[w|o]\).*/\1/p") PS1='\[\033[01;32m\]\u@\h${fs_mode:+($fs_mode)}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' } alias ro='sudo mount -o remount,ro / ; sudo mount -o remount,ro /home' alias rw='sudo mount -o remount,rw / ; sudo mount -o remount,rw /home' # setup fancy prompt" PROMPT_COMMAND=set_bash_prompt cat << EOF >> /etc/bash.bashrc # set variable identifying the filesystem you work in (used in the prompt below) set_bash_prompt(){ fs_mode=$(mount | sed -n -e "s/^\/dev\/.* on \/ .*(\(r[w|o]\).*/\1/p") PS1='\[\033[01;32m\]\u@\h${fs_mode:+($fs_mode)}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' } alias ro='sudo mount -o remount,ro /' alias rw='sudo mount -o remount,rw /' # setup fancy prompt" PROMPT_COMMAND=set_bash_prompt EOF cat << EOF >> /etc/bash.bash_logout mount -o remount,rw / history -a mount -o remount,ro / EOF sed -i 's/usr\/bin\/X/usr\/bin\/X\ \-logfile\ \/tmp\/Xorg.0.log/' /etc/X11/xinit/xserverrc