Advertisement
Guest User

Untitled

a guest
Oct 15th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.43 KB | None | 0 0
  1. #!/bin/bash
  2. apt-get remove  dphys-swapfile
  3. apt-get install busybox-syslogd; dpkg --purge rsyslog
  4. sed -i 's/$/ fastboot noswap ro/' /boot/cmdline.txt
  5. rm -rf /var/lib/dhcp/ /var/run /var/spool /var/lock /etc/resolv.conf
  6. ln -s /tmp /var/lib/dhcp
  7. ln -s /tmp /var/run
  8. ln -s /tmp /var/spool
  9. ln -s /tmp /var/lock
  10. touch /tmp/dhcpcd.resolv.conf; ln -s /tmp/dhcpcd.resolv.conf /etc/resolv.conf
  11. rm /var/lib/systemd/random-seed
  12. ln -s /tmp/random-seed /var/lib/systemd/random-seed
  13. sed -i '21iExecStartPre=/bin/echo "" >/tmp/random-seed' /lib/systemd/system/systemd-random-seed.service
  14. systemctl daemon-reload
  15. sed -i '7i\ \ mount -o remount,rw /' /etc/cron.hourly/fake-hwclock
  16. sed -i '9i\ \ mount -o remount,ro /' /etc/cron.hourly/fake-hwclock
  17. insserv -r bootlogs;
  18. 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
  19. sed -i 's/ext4    errors=remount-ro,rw,noatime,nodiratime                   0 1/ext4    errors=remount-ro,ro,noatime,nodiratime                   0 1/' /etc/fstab
  20. echo "tmpfs              /var/log     tmpfs   nodev,nosuid,mode=1777                                    0 0" >> /etc/fstab
  21. echo "tmpfs              /var/tmp     tmpfs   nodev,nosuid,mode=1777                                    0 0" >> /etc/fstab
  22.  
  23. # set variable identifying the filesystem you work in (used in the prompt below)
  24. set_bash_prompt(){
  25.     fs_mode=$(mount | sed -n -e "s/^\/dev\/.* on \/ .*(\(r[w|o]\).*/\1/p")
  26.     PS1='\[\033[01;32m\]\u@\h${fs_mode:+($fs_mode)}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  27. }
  28.  
  29. alias ro='sudo mount -o remount,ro / ; sudo mount -o remount,ro /home'
  30. alias rw='sudo mount -o remount,rw / ; sudo mount -o remount,rw /home'
  31. # setup fancy prompt"
  32. PROMPT_COMMAND=set_bash_prompt
  33.  
  34. cat << EOF >> /etc/bash.bashrc
  35. # set variable identifying the filesystem you work in (used in the prompt below)
  36. set_bash_prompt(){
  37.     fs_mode=$(mount | sed -n -e "s/^\/dev\/.* on \/ .*(\(r[w|o]\).*/\1/p")
  38.     PS1='\[\033[01;32m\]\u@\h${fs_mode:+($fs_mode)}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  39. }
  40.  
  41. alias ro='sudo mount -o remount,ro /'
  42. alias rw='sudo mount -o remount,rw /'
  43. # setup fancy prompt"
  44. PROMPT_COMMAND=set_bash_prompt
  45. EOF
  46.  
  47. cat << EOF >> /etc/bash.bash_logout
  48. mount -o remount,rw /
  49. history -a
  50. mount -o remount,ro /
  51. EOF
  52.  
  53. sed -i 's/usr\/bin\/X/usr\/bin\/X\ \-logfile\ \/tmp\/Xorg.0.log/' /etc/X11/xinit/xserverrc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement