InstallPackages.sh 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. #!/bin/bash -e
  2. # This file is part of PrawnOS (http://www.prawnos.com)
  3. # Copyright (c) 2018 Hal Emmerich <hal@halemmerich.com>
  4. # PrawnOS is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License version 2
  6. # as published by the Free Software Foundation.
  7. # PrawnOS is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. # You should have received a copy of the GNU General Public License
  12. # along with PrawnOS. If not, see <https://www.gnu.org/licenses/>.
  13. DIR=/InstallResources
  14. cat $DIR/icons/ascii-icon.txt
  15. echo ""
  16. while true; do
  17. read -p "Install (X)fce4, (L)xqt or (G)nome, if unsure choose (X)fce: " XL
  18. case $XL in
  19. [Gg]* ) DE=gnome; break;;
  20. [Xx]* ) DE=xfce; break;;
  21. [Ll]* ) DE=lxqt; break;;
  22. * ) echo "Please answer (X)fce4, (L)xqt or (G)nome";;
  23. esac
  24. done
  25. #Set the timezone
  26. dpkg-reconfigure tzdata
  27. #Install shared packages
  28. DEBIAN_FRONTEND=noninteractive apt install -y xorg acpi-support tasksel dpkg librsvg2-common xorg xserver-xorg-input-libinput alsa-utils anacron avahi-daemon eject iw libnss-mdns xdg-utils dconf-cli dconf-editor sudo dtrx emacs sysfsutils bluetooth
  29. DEBIAN_FRONTEND=noninteractive apt install -y network-manager-gnome network-manager-openvpn network-manager-openvpn-gnome
  30. DEBIAN_FRONTEND=noninteractive apt install -y libegl-mesa0 libegl1-mesa libgl1-mesa-dri libglapi-mesa libglu1-mesa libglx-mesa0
  31. # Browsers
  32. DEBIAN_FRONTEND=noninteractive apt install -y firefox-esr
  33. DEBIAN_FRONTEND=noninteractive apt install -y chromium
  34. [ "$DE" = "gnome" ] && apt install -y gdm3 gnome-session dbus-user-session gnome-shell-extensions nautilus nautilus-admin file-roller gnome-software gnome-software-plugin-flatpak gedit gnome-system-monitor gnome-logs evince gnome-disk-utility gnome-terminal fonts-cantarell gnome-tweaks seahorse papirus-icon-theme materia-gtk-theme eog
  35. [ "$DE" = "xfce" ] && apt install -y lightdm mousepad vlc xfce4 dbus-user-session system-config-printer tango-icon-theme xfce4-power-manager xfce4-terminal xfce4-goodies numix-gtk-theme plank accountsservice papirus-icon-theme
  36. [ "$DE" = "lxqt" ] && apt install -y lightdm lxqt pavucontrol-qt
  37. #install the keymap by patching xkb, then bindings work for any desktop environment
  38. cp $DIR/xkb/compat/* /usr/share/X11/xkb/compat/
  39. cp $DIR/xkb/keycodes/* /usr/share/X11/xkb/keycodes/
  40. cp $DIR/xkb/symbols/* /usr/share/X11/xkb/symbols/
  41. patch /usr/share/X11/xkb/rules/base < $DIR/xkb/rules/base.chromebook.patch
  42. patch /usr/share/X11/xkb/rules/base.lst < $DIR/xkb/rules/base.lst.chromebook.patch
  43. patch /usr/share/X11/xkb/rules/base.xml < $DIR/xkb/rules/base.xml.chromebook.patch
  44. patch /usr/share/X11/xkb/rules/evdev < $DIR/xkb/rules/evdev.chromebook.patch
  45. patch /usr/share/X11/xkb/rules/evdev.lst < $DIR/xkb/rules/evdev.lst.chromebook.patch
  46. patch /usr/share/X11/xkb/rules/evdev.xml < $DIR/xkb/rules/evdev.xml.chromebook.patch
  47. cp $DIR/xkb/keyboard /etc/default/keyboard
  48. #disable ertm for csr8510 bluetooth, issue #117
  49. echo "module/bluetooth/parameters/disable_ertm = 1" > /etc/sysfs.conf
  50. if [ "$DE" = "gnome" ]
  51. then
  52. #install firefox-esr default settings
  53. cp $DIR/firefox-esr/prawn-settings.js /usr/lib/firefox-esr/defaults/pref/
  54. cp $DIR/firefox-esr/prawn.cfg /usr/lib/firefox-esr/
  55. #TODO: a config file way to do the following would be nice, so that we can install the configs now instead
  56. # of having to run the following commands after login
  57. #Natural scrolling is un-natural
  58. # gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll false
  59. #Tap to click is natural
  60. # gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true
  61. fi
  62. if [ "$DE" = "xfce" ]
  63. then
  64. # remove light-locker, as it is broken on this machine. See issue https://github.com/SolidHal/PrawnOS/issues/56#issuecomment-504681175
  65. apt remove -y light-locker
  66. apt purge -y light-locker
  67. #xsecurelock is the lightest weight, actually functional screen locker I have been able to find
  68. # light-locker is outright broken, and xfce4-screensaver crashes if system
  69. # is told to sleep at lid close, and activate lock
  70. # gnome-screensaver shows the desktop for a fraction of a second at wakeup
  71. # xscreensaver works as well, if you prefer that but is less simple
  72. DEBIAN_FRONTEND=noninteractive apt install -y xsecurelock
  73. #Install packages not in an apt repo
  74. dpkg -i $DIR/xfce-themes/*
  75. #Copy in xfce4 default settings
  76. cp -f $DIR/xfce-config/xfce-perchannel-xml/* /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/
  77. cp -f $DIR/xfce-config/panel/* /etc/xdg/xfce4/panel/
  78. #Copy in lightdm/light greeter settings
  79. cp -f $DIR/icons/icon-small.png /etc/lightdm/icon.png
  80. chmod 644 /etc/lightdm/icon.png
  81. cp -f $DIR/xfce-config/lightdm/* /etc/lightdm/
  82. #Patch xflock4 to activate xsecurelock
  83. patch /usr/bin/xflock4 < $DIR/xfce-config/xflock-xsecurelock.patch
  84. #Copy in wallpapers
  85. rm /usr/share/images/desktop-base/default && cp $DIR/wallpapers/* /usr/share/images/desktop-base/
  86. #Install libinput-gestures and xfdashboard "packages"
  87. cd $DIR/packages/
  88. dtrx libinput-gestures.tar.gz
  89. cd libinput-gestures
  90. make install
  91. cd ..
  92. #Add libinput-gestures config and autostart
  93. cp $DIR/xfce-config/libinput-gestures/libinput-gestures.conf /etc/
  94. cp $DIR/xfce-config/libinput-gestures/libinput-gestures.desktop /etc/xdg/autostart/
  95. #Make plank autostart
  96. cp $DIR/xfce-config/plank/plank.desktop /etc/xdg/autostart/
  97. #install plank launcher
  98. mkdir -p /etc/skel/.config/plank/dock1/launchers/
  99. cp -rf $DIR/xfce-config/plank/plank-launchers/* /etc/skel/.config/plank/dock1/launchers/
  100. #install firefox-esr default settings
  101. cp $DIR/firefox-esr/prawn-settings.js /usr/lib/firefox-esr/defaults/pref/
  102. cp $DIR/firefox-esr/prawn.cfg /usr/lib/firefox-esr/
  103. #Install the source code pro font for spacemacs
  104. [ -d /usr/share/fonts/opentype ] || mkdir /usr/share/fonts/opentype
  105. cp -rf $DIR/fonts/* /usr/share/fonts/opentype/
  106. fc-cache
  107. #Install inputrc
  108. cp -rf $DIR/xfce-config/inputrc/.inputrc /etc/skel/
  109. #Install brightness control scripts
  110. cp $DIR/xfce-config/brightness/backlight_* /usr/sbin/
  111. fi
  112. #Copy in acpi, pulse audio, trackpad settings, funtion key settings
  113. cp -rf $DIR/default.pa /etc/pulse/default.pa
  114. # Disable flat-volumes in pulseaudio, fixes broken sound for some sources in firefox
  115. echo "flat-volumes = no" > /etc/pulse/daemon.conf
  116. cp -rf $DIR/sound.sh /etc/acpi/sound.sh
  117. cp -rf $DIR/headphone-acpi-toggle /etc/acpi/events/headphone-acpi-toggle
  118. mkdir /etc/X11/xorg.conf.d/
  119. cp -rf $DIR/30-touchpad.conf /etc/X11/xorg.conf.d/
  120. apt clean -y && apt autoremove --purge -y
  121. #reload the CA certificate symlinks
  122. update-ca-certificates --fresh
  123. #enable periodic TRIM
  124. cp /lib/systemd/system/fstrim.{service,timer} /etc/systemd/system
  125. systemctl enable fstrim.timer
  126. dmesg -D
  127. echo ""
  128. echo ""
  129. echo ""
  130. cat $DIR/icons/ascii-icon.txt
  131. echo ""
  132. echo "*************Welcome To PrawnOS*************"
  133. echo ""
  134. #Have the user set a root password
  135. echo "-----Enter a password for the root user-----"
  136. until passwd
  137. do
  138. echo "-----Enter a password for the root user-----"
  139. passwd
  140. done
  141. #Force a safe username
  142. while true; do
  143. echo "-----Enter new username:-----"
  144. read username
  145. #ensure no whitespace
  146. case $username in *\ *) echo usernames may not contain whitespace;; *) break;; esac
  147. done
  148. until adduser $username --gecos ""
  149. do
  150. while true; do
  151. echo "-----Enter new username:-----"
  152. read username
  153. #ensure no whitespace
  154. case $username in *\ *) echo usernames may not contain whitespace;; *) break;; esac
  155. done
  156. done
  157. usermod -a -G sudo,netdev,input,video,bluetooth $username
  158. dmesg -E