init 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/dash -e
  2. # this file is part of Devsus.
  3. #
  4. # Copyright 2018 Dima Krasner
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  19. # MA 02110-1301, USA.
  20. if [ -f /debootstrap/debootstrap ]
  21. then
  22. clear
  23. /debootstrap/debootstrap --second-stage
  24. passwd -d root
  25. echo -n devsus > /etc/hostname
  26. # install stable release updates as soon as they're available
  27. install -m 644 /opt/devsus/sources.list /etc/apt/sources.list
  28. # disable installation of recommended, not strictly necessary packages
  29. install -D -m 644 /opt/devsus/80disable-recommends /etc/apt/apt.conf.d/80disable-recommends
  30. apt-get autoremove --purge
  31. apt-get clean
  32. # set the default PulseAudio devices; otherwise, it uses dummy ones
  33. echo "load-module module-alsa-sink device=sysdefault
  34. load-module module-alsa-source device=sysdefault" >> /etc/pulse/default.pa
  35. # disable saving of dmesg output in /var/log
  36. update-rc.d bootlogs disable
  37. # reduce the number of virtual consoles
  38. sed -i s/^[3-6]/\#\&/g /etc/inittab
  39. # enable DNS cache
  40. sed -i s/'enable-cache hosts no'/'enable-cache hosts yes'/ -i /etc/nscd.conf
  41. # prevent DNS lookup of the default hostname, which dicloses the OS to a
  42. # potential attacker
  43. echo "127.0.0.1 devsus" >> /etc/hosts
  44. # use global NTP servers instead of those that diclose the OS
  45. sed -i s/debian\.pool/pool/g -i /etc/ntp.conf
  46. # block malware and advertising domains
  47. cat /opt/devsus/hosts >> /etc/hosts
  48. rm -f /var/log/*log /var/log/dmesg /var/log/fsck/* /var/log/apt/*
  49. # allow unprivileged users to write to /sys/devices/platform/backlight/backlight/backlight/brightness
  50. install -m 644 /opt/devsus/99-brightness.rules /etc/udev/rules.d/99-brightness.rules
  51. # give ath9k_htc devices a random MAC address
  52. install -m 644 /opt/devsus/98-mac.rules /etc/udev/rules.d/98-mac.rules
  53. # make /tmp a tmpfs, to reduce disk I/O
  54. install -m 644 /opt/devsus/fstab /etc/fstab
  55. install -m 644 /opt/devsus/.xbindkeysrc /etc/skel/.xbindkeysrc
  56. install -D -m 644 /opt/devsus/htoprc /etc/skel/.config/htop/htoprc
  57. install -m 744 /opt/devsus/.xinitrc /etc/skel/.xinitrc
  58. install -m 644 /opt/devsus/.Xresources /etc/skel/.Xresources
  59. install -m 644 /opt/devsus/.ratpoisonrc /etc/skel/.ratpoisonrc
  60. # enable font hinting
  61. install -D -m 644 /opt/devsus/99-hinting.conf /etc/skel/.config/fontconfig/conf.d/99-hinting.conf
  62. # set the cursor theme
  63. install -D -m 644 /opt/devsus/index.theme /etc/skel/.icons/default/index.theme
  64. # change the default settings of firefox-esr
  65. install -m 644 /opt/devsus/devsus-settings.js /usr/lib/firefox-esr/defaults/pref/devsus-settings.js
  66. install -m 644 /opt/devsus/devsus.cfg /usr/lib/firefox-esr/devsus.cfg
  67. clear
  68. fi
  69. exec /sbin/init