2022-03-09 09:39:48 +00:00
|
|
|
apt remove -y --purge triggerhappy logrotate dphys-swapfile cron
|
|
|
|
apt autoremove -y --purge
|
|
|
|
apt install -y busybox-syslogd
|
|
|
|
apt remove -y --purge rsyslog
|
|
|
|
sh -c 'echo -n "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 's#ExecStart=/lib/systemd/systemd-random-seed load#ExecStartPre=/bin/echo "" >/tmp/random-seed\nExecStart=/lib/systemd/systemd-random-seed load#' /lib/systemd/system/systemd-random-seed.service
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl disable console-setup
|
|
|
|
sed -i 's#\(.*PARTUUID.*defaults\)\(.*\)#\1,ro\2#' /etc/fstab
|
|
|
|
cat <<EOT >>/etc/fstab
|
2022-03-03 08:44:16 +00:00
|
|
|
|
|
|
|
tmpfs /tmp tmpfs nosuid,nodev 0 0
|
|
|
|
tmpfs /var/log tmpfs nosuid,nodev 0 0
|
|
|
|
tmpfs /var/tmp tmpfs nosuid,nodev 0 0
|
|
|
|
EOT
|
|
|
|
|
2022-03-09 09:39:48 +00:00
|
|
|
cat <<"EOT" >>/etc/bash.bashrc
|
2022-03-03 08:44:16 +00:00
|
|
|
# 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 /boot'
|
|
|
|
alias rw='sudo mount -o remount,rw / ; sudo mount -o remount,rw /boot'
|
|
|
|
|
2022-03-09 09:39:48 +00:00
|
|
|
# setup fancy prompt
|
2022-03-03 08:44:16 +00:00
|
|
|
PROMPT_COMMAND=set_bash_prompt
|
|
|
|
EOT
|
|
|
|
|
2022-03-09 09:39:48 +00:00
|
|
|
cat <<EOT >>/etc/bash.bash_logout
|
2022-03-03 08:59:38 +00:00
|
|
|
sudo mount -o remount,rw /
|
2022-03-03 08:44:16 +00:00
|
|
|
history -a
|
2022-03-03 08:59:38 +00:00
|
|
|
sudo mount -o remount,ro /
|
|
|
|
sudo mount -o remount,ro /boot
|
2022-03-03 08:44:16 +00:00
|
|
|
EOT
|