Corrections, sudo, ...

This commit is contained in:
starcalc 2022-03-03 08:59:38 +00:00
parent 705e17d48d
commit bffad8f7cf
1 changed files with 23 additions and 25 deletions

View File

@ -1,30 +1,28 @@
apt remove -y --purge triggerhappy logrotate dphys-swapfile cron sudo apt remove -y --purge triggerhappy logrotate dphys-swapfile cron
apt autoremove -y --purge sudo apt autoremove -y --purge
apt install -y busybox-syslogd sudo apt install -y busybox-syslogd
# dpkg --purge rsyslog sudo apt remove -y --purge rsyslog
apt remove -y --purge rsyslog sudo sh -c 'echo -n "fastboot noswap ro" >>/boot/cmdline.txt'
echo -n "fastboot noswap ro" >>/boot/cmdline.txt sudo rm -rf /var/lib/dhcp/ /var/run /var/spool /var/lock /etc/resolv.conf
rm -rf /var/lib/dhcp/ /var/run /var/spool /var/lock /etc/resolv.conf sudo ln -s /tmp /var/lib/dhcp
ln -s /tmp /var/lib/dhcp sudo ln -s /tmp /var/run
ln -s /tmp /var/run sudo ln -s /tmp /var/spool
ln -s /tmp /var/spool sudo ln -s /tmp /var/lock
ln -s /tmp /var/lock sudo touch /tmp/dhcpcd.resolv.conf; ln -s /tmp/dhcpcd.resolv.conf /etc/resolv.conf
touch /tmp/dhcpcd.resolv.conf; ln -s /tmp/dhcpcd.resolv.conf /etc/resolv.conf sudo rm /var/lib/systemd/random-seed
rm /var/lib/systemd/random-seed sudo ln -s /tmp/random-seed /var/lib/systemd/random-seed
ln -s /tmp/random-seed /var/lib/systemd/random-seed sudo 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
sed -i /lib/systemd/system/systemd-random-seed.service 's#ExecStart=/lib/systemd/systemd-random-seed load#ExecStartPre=/bin/echo "" >/tmp/random-seed\nExecStart=/lib/systemd/systemd-random-seed load#' sudo systemctl daemon-reload
systemctl daemon-reload sudo systemctl disable console-setup
insserv -r bootlogs sudo sed -i 's#\(.*PARTUUID.*defaults\)\(.*\)#\1,ro\2#' /etc/fstab
insserv -r console-setup sudo cat <<EOT >>/etc/fstab
sed -i /etc/fstab 's#\(.*PARTUUID.*defaults\)\(.*\)#\1,ro\2#'
cat <<EOT >>/etc/fstab
tmpfs /tmp tmpfs nosuid,nodev 0 0 tmpfs /tmp tmpfs nosuid,nodev 0 0
tmpfs /var/log tmpfs nosuid,nodev 0 0 tmpfs /var/log tmpfs nosuid,nodev 0 0
tmpfs /var/tmp tmpfs nosuid,nodev 0 0 tmpfs /var/tmp tmpfs nosuid,nodev 0 0
EOT EOT
cat <<EOT >>/etc/bash.bashrc sudo cat <<EOT >>/etc/bash.bashrc
# set variable identifying the filesystem you work in (used in the prompt below) # set variable identifying the filesystem you work in (used in the prompt below)
set_bash_prompt(){ set_bash_prompt(){
fs_mode=$(mount | sed -n -e "s/^\/dev\/.* on \/ .*(\(r[w|o]\).*/\1/p") fs_mode=$(mount | sed -n -e "s/^\/dev\/.* on \/ .*(\(r[w|o]\).*/\1/p")
@ -38,9 +36,9 @@ alias rw='sudo mount -o remount,rw / ; sudo mount -o remount,rw /boot'
PROMPT_COMMAND=set_bash_prompt PROMPT_COMMAND=set_bash_prompt
EOT EOT
cat <<EOT >>/etc/bash.bash_logout sudo cat <<EOT >>/etc/bash.bash_logout
mount -o remount,rw / sudo mount -o remount,rw /
history -a history -a
mount -o remount,ro / sudo mount -o remount,ro /
mount -o remount,ro /boot sudo mount -o remount,ro /boot
EOT EOT