InstallPackages.sh 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. # Import the package lists
  15. source $DIR/package_lists.sh
  16. cat $DIR/icons/ascii-icon.txt
  17. echo ""
  18. while true; do
  19. read -p "Install (X)fce4, (L)xqt or (G)nome, if unsure choose (X)fce: " XL
  20. case $XL in
  21. [Gg]* ) DE=gnome; break;;
  22. [Xx]* ) DE=xfce; break;;
  23. [Ll]* ) DE=lxqt; break;;
  24. * ) echo "Please answer (X)fce4, (L)xqt or (G)nome";;
  25. esac
  26. done
  27. #Set the timezone
  28. dpkg-reconfigure tzdata
  29. #Install shared packages
  30. DEBIAN_FRONTEND=noninteractive apt install -y ${base_debs_download[@]}
  31. DEBIAN_FRONTEND=noninteractive apt install -y ${mesa_debs_download[@]}
  32. DEBIAN_FRONTEND=noninteractive apt install -y ${prawnos_base_debs_prebuilt_download[@]}
  33. [ "$DE" = "gnome" ] && apt install -y ${gnome_debs_download[@]}
  34. [ "$DE" = "xfce" ] && apt install -y ${xfce_debs_download[@]} ${prawnos_base_debs_prebuilt_install[@]}
  35. [ "$DE" = "lxqt" ] && apt install -y ${lxqt_debs_download[@]}
  36. #install the keymap by patching xkb, then bindings work for any desktop environment
  37. cp $DIR/xkb/compat/* /usr/share/X11/xkb/compat/
  38. cp $DIR/xkb/keycodes/* /usr/share/X11/xkb/keycodes/
  39. cp $DIR/xkb/symbols/* /usr/share/X11/xkb/symbols/
  40. patch /usr/share/X11/xkb/rules/base < $DIR/xkb/rules/base.chromebook.patch
  41. patch /usr/share/X11/xkb/rules/base.lst < $DIR/xkb/rules/base.lst.chromebook.patch
  42. patch /usr/share/X11/xkb/rules/base.xml < $DIR/xkb/rules/base.xml.chromebook.patch
  43. patch /usr/share/X11/xkb/rules/evdev < $DIR/xkb/rules/evdev.chromebook.patch
  44. patch /usr/share/X11/xkb/rules/evdev.lst < $DIR/xkb/rules/evdev.lst.chromebook.patch
  45. patch /usr/share/X11/xkb/rules/evdev.xml < $DIR/xkb/rules/evdev.xml.chromebook.patch
  46. cp $DIR/xkb/keyboard /etc/default/keyboard
  47. #disable ertm for csr8510 bluetooth, issue #117
  48. echo "module/bluetooth/parameters/disable_ertm = 1" > /etc/sysfs.conf
  49. if [ "$DE" = "gnome" ]
  50. then
  51. #install firefox-esr default settings
  52. cp $DIR/firefox-esr/prawn-settings.js /usr/lib/firefox-esr/defaults/pref/
  53. cp $DIR/firefox-esr/prawn.cfg /usr/lib/firefox-esr/
  54. #TODO: a config file way to do the following would be nice, so that we can install the configs now instead
  55. # of having to run the following commands after login
  56. #Natural scrolling is un-natural
  57. # gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll false
  58. #Tap to click is natural
  59. # gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true
  60. fi
  61. if [ "$DE" = "xfce" ]
  62. then
  63. # remove light-locker, as it is broken on this machine. See issue https://github.com/SolidHal/PrawnOS/issues/56#issuecomment-504681175
  64. apt remove -y light-locker
  65. apt purge -y light-locker
  66. #Install packages not in an apt repo
  67. dpkg -i $DIR/xfce-themes/*
  68. #Copy in xfce4 default settings
  69. cp -f $DIR/xfce-config/xfce-perchannel-xml/* /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/
  70. cp -f $DIR/xfce-config/panel/* /etc/xdg/xfce4/panel/
  71. #Copy in lightdm/light greeter settings
  72. cp -f $DIR/icons/icon-small.png /etc/lightdm/icon.png
  73. chmod 644 /etc/lightdm/icon.png
  74. cp -f $DIR/xfce-config/lightdm/* /etc/lightdm/
  75. #Patch xflock4 to activate xsecurelock
  76. patch /usr/bin/xflock4 < $DIR/xfce-config/xflock-xsecurelock.patch
  77. #Copy in wallpapers
  78. rm /usr/share/images/desktop-base/default && cp $DIR/wallpapers/* /usr/share/images/desktop-base/
  79. #Install libinput-gestures and xfdashboard "packages"
  80. cd $DIR/packages/
  81. dtrx libinput-gestures.tar.gz
  82. cd libinput-gestures
  83. make install
  84. cd ..
  85. #Add libinput-gestures config and autostart
  86. cp $DIR/xfce-config/libinput-gestures/libinput-gestures.conf /etc/
  87. cp $DIR/xfce-config/libinput-gestures/libinput-gestures.desktop /etc/xdg/autostart/
  88. #Make plank autostart
  89. cp $DIR/xfce-config/plank/plank.desktop /etc/xdg/autostart/
  90. #install plank launcher
  91. mkdir -p /etc/skel/.config/plank/dock1/launchers/
  92. cp -rf $DIR/xfce-config/plank/plank-launchers/* /etc/skel/.config/plank/dock1/launchers/
  93. #install firefox-esr default settings
  94. cp $DIR/firefox-esr/prawn-settings.js /usr/lib/firefox-esr/defaults/pref/
  95. cp $DIR/firefox-esr/prawn.cfg /usr/lib/firefox-esr/
  96. #Install the source code pro font for spacemacs
  97. [ -d /usr/share/fonts/opentype ] || mkdir /usr/share/fonts/opentype
  98. cp -rf $DIR/fonts/* /usr/share/fonts/opentype/
  99. fc-cache
  100. #Install inputrc
  101. cp -rf $DIR/xfce-config/inputrc/.inputrc /etc/skel/
  102. #Install brightness control scripts
  103. cp $DIR/xfce-config/brightness/backlight_* /usr/sbin/
  104. fi
  105. #Copy in acpi, pulse audio, trackpad settings, funtion key settings
  106. cp -rf $DIR/default.pa /etc/pulse/default.pa
  107. # Disable flat-volumes in pulseaudio, fixes broken sound for some sources in firefox
  108. echo "flat-volumes = no" > /etc/pulse/daemon.conf
  109. cp -rf $DIR/sound.sh /etc/acpi/sound.sh
  110. cp -rf $DIR/headphone-acpi-toggle /etc/acpi/events/headphone-acpi-toggle
  111. mkdir /etc/X11/xorg.conf.d/
  112. cp -rf $DIR/30-touchpad.conf /etc/X11/xorg.conf.d/
  113. apt clean -y && apt autoremove --purge -y
  114. #reload the CA certificate symlinks
  115. update-ca-certificates --fresh
  116. #enable periodic TRIM
  117. cp /lib/systemd/system/fstrim.{service,timer} /etc/systemd/system
  118. systemctl enable fstrim.timer
  119. dmesg -D
  120. echo ""
  121. echo ""
  122. echo ""
  123. cat $DIR/icons/ascii-icon.txt
  124. echo ""
  125. echo "*************Welcome To PrawnOS*************"
  126. echo ""
  127. #Have the user set a root password
  128. echo "-----Enter a password for the root user-----"
  129. until passwd
  130. do
  131. echo "-----Enter a password for the root user-----"
  132. passwd
  133. done
  134. #Force a safe username
  135. while true; do
  136. echo "-----Enter new username:-----"
  137. read username
  138. #ensure no whitespace
  139. case $username in *\ *) echo usernames may not contain whitespace;; *) break;; esac
  140. done
  141. until adduser $username --gecos ""
  142. do
  143. while true; do
  144. echo "-----Enter new username:-----"
  145. read username
  146. #ensure no whitespace
  147. case $username in *\ *) echo usernames may not contain whitespace;; *) break;; esac
  148. done
  149. done
  150. usermod -a -G sudo,netdev,input,video,bluetooth $username
  151. dmesg -E