Advertisement
ErwinO1991

ArAA-Openbox software script

May 30th, 2017
706
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 9.85 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. set -e
  4.  
  5. if [[ $EUID -eq 0 ]]; then
  6.     echo "This script can't be used as root" >&2
  7.     exit 1
  8. fi
  9.  
  10. echo "This script was written by Erwin Oldebesten on 30/05/2017"
  11. echo""
  12. echo "You may use, edit and share if you like to, but credit the original creator"
  13. echo "when you share and/or edit this script."
  14. echo ""
  15. echo "WARNING!: By no means, is the script creator liable for any damage"
  16. echo "this script creates, either softwarematic or otherwise."
  17. echo "Use it at your own risk!"
  18. sleep 5
  19.  
  20. HOME="${HOME:-$(getent passwd "$(id -un)" | cut -d: -f6)}"
  21. XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
  22.  
  23. sudo pacman -S git-core wmctrl --noconfirm --needed
  24. git clone https://aur.archlinux.org/cower.git
  25. git clone https://aur.archlinux.org/opensnap.git
  26. git clone https://aur.archlinux.org/pacaur.git
  27. gpg --recv-keys --keyserver hkp://pgp.mit.edu 1EB2638FF56C0C53
  28. cd ./cower
  29. makepkg -sir --noconfirm --needed
  30. cd ../opensnap
  31. makepkg -sird --noconfirm --needed
  32. cd ../pacaur
  33. makepkg -sir --noconfirm --needed
  34. cd ../
  35. rm -rf ./cower
  36. rm -rf ./opensnap
  37. rm -rf ./pacaur
  38.  
  39.  
  40. pacaur -S --noconfirm --needed --noedit lynx networkmanager network-manager-applet obconf openbox sddm transset-df ttf-dejavu wpa_actiond wireless_tools xdotool xorg-apps xorg-server xorg-xinit xterm arch-wiki-cli fetchpkg fetchmirrors htop pavucontrol libreoffice-still gimp firefox thunderbird hunspell-en hunspell-nl atril engrampa-thunar-gtk2 vlc mpv alsa-utils alsa-oss ragel cmake pulseaudio pulseaudio-alsa git kalu gufw transmission-gtk menulibre galculator-gtk2 gtk-engines cups cups-filters cups-pdf ristretto gnome-icon-theme network-manager-applet xfce4-notifyd simple-scan ntfs-3g dosfstools exfat-utils gparted brasero mintstick-git noto-fonts gxmessage zip unzip unrar p7zip thunar-volman xcompmgr pv progress thunar-archive-plugin wget gksu tumbler qt4 ffmpegthumbnailer pluma lxtask xfce4-panel xfce4-pulseaudio-plugin xfce4-terminal xfce4-whiskermenu-plugin xfconf xfdesktop numlockx xscreensaver system-config-printer
  41.  
  42. echo "Do you want to install flash and oracle-java runtime as well?"
  43. echo ""
  44. select yn in "Yes" "No"; do
  45.     case $yn in
  46.         Yes ) pacaur -S flashplugin pepper-flash jre --noconfirm --needed --noedit; break;;
  47.         No ) break;;
  48.     esac
  49. done
  50.  
  51. cat <<-EOF > "$HOME"/shutdown-manager-link.desktop
  52.     [Desktop Entry]
  53.     Encoding=UTF-8
  54.     Name=Shutdown Manager Link
  55.     Type=Link
  56.     URL=https://goo.gl/NW5bc0
  57.     Icon=text-html
  58.     EOF
  59.  
  60. chmod +x "$HOME"/shutdown-manager-link.desktop
  61.  
  62. echo ""
  63. echo "The installation is finished, if you need to install oracle-java and"
  64. echo 'flash you can install it with "pacaur -S jre flashplugin pepper-flash "'
  65. echo "as a priviledged non-root user."
  66. echo ""
  67. echo "If you need a shutdown-manager you can find a simple one here:"
  68. echo '"https://goo.gl/NW5bc0" this link will be saved in your home folder'
  69. sleep 5
  70.  
  71. echo ""
  72. echo "Starting basic system configuration"
  73. echo ""
  74. sleep 1
  75.  
  76. echo "Configuring Thunar"
  77. echo ""
  78. mkdir -p "$XDG_CONFIG_HOME"/Thunar
  79. cat <<-EOF > "$XDG_CONFIG_HOME"/Thunar/uca.xml
  80. <?xml encoding="UTF-8" version="1.0"?>
  81. <actions>
  82. <action>
  83.     <icon>utilities-terminal</icon>
  84.     <name>Open Terminal Here</name>
  85.     <unique-id>1496773885381426-1</unique-id>
  86.     <command>exo-open --working-directory %f --launch TerminalEmulator</command>
  87.     <patterns>*</patterns>
  88.     <startup-notify/>
  89.     <directories/>
  90. </action>
  91. <action>
  92.     <icon></icon>
  93.     <name>Open as root</name>
  94.     <unique-id>1496776056149709-4</unique-id>
  95.     <command>gksu thunar %f</command>
  96.     <description></description>
  97.     <patterns>*</patterns>
  98.     <directories/>
  99. </action>
  100. </actions>
  101.  
  102. EOF
  103.  
  104.  
  105. echo "Editting the standard programs (mimeapps)"
  106. echo ""
  107. sleep 3
  108.  
  109. cat <<-EOF > "$XDG_CONFIG_HOME"/mimeapps.list
  110.     [Added Associations]
  111.     text/plain=pluma.desktop;
  112.     application/zip=engrampa.desktop;
  113.     application/x-ms-dos-executable=wine.desktop;
  114.     audio/x-vorbis+ogg=vlc.desktop;mpv.desktop;
  115.     image/jpeg=gimp.desktop;ristretto.desktop;
  116.     image/png=gimp.desktop;ristretto.desktop;
  117.     image/bmp=gimp.desktop;ristretto.desktop;
  118.     video/mp4=mpv.desktop;
  119.     application/vnd.rar=engrampa.desktop;
  120.     application/x-java-archive=sun-java-jre8.desktop;
  121.     video/x-matroska=mpv.desktop;
  122.     application/x-desktop=pluma.desktop;
  123.     application/x-compressed-tar=engrampa.desktop;
  124.     application/x-shellscript=pluma.desktop;
  125.     application/msword=libreoffice-writer.desktop;
  126.     application/x-7z-compressed=engrampa.desktop;
  127.     application/pdf=atril.desktop;
  128.     application/xml=pluma.desktop;
  129.     audio/mpeg=vlc.desktop;mpv.desktop;
  130.  
  131.     [Default Applications]
  132.     application/x-ms-dos-executable=wine.desktop
  133.     audio/x-vorbis+ogg=vlc.desktop
  134.     image/jpeg=ristretto.desktop
  135.     image/png=ristretto.desktop
  136.     image/bmp=ristretto.desktop
  137.     video/mp4=mpv.desktop
  138.     video/x-matroska=mpv.desktop
  139.     application/pdf=atril.desktop
  140.     application/xml=pluma.desktop
  141.     EOF
  142.  
  143. sudo mkdir -p /root/.config
  144. sudo cp "$XDG_CONFIG_HOME"/mimeapps.list /root/.config/mimeapps.list
  145.  
  146. function x11edit {
  147.  
  148. echo "First, we'll determine your keyboard layout"
  149. echo "Type the two letters of your desired country code and press [ENTER]: "
  150. read -r country
  151. echo "Do you want to use a variant? If not, leave empty. Confirm with [ENTER] :"
  152. read -r variant
  153. echo "Are you content with this settings?"
  154. echo ""
  155. select ync in "Yes" "No" "Cancel"; do
  156.     case $ync in
  157.         Yes ) x11conf; break;;
  158.         No ) x11edit break;;
  159.         Cancel ) break;;
  160.     esac
  161. done
  162. }
  163.  
  164. function x11conf {
  165. echo "Editing 00-keyboard.conf"
  166. echo ""
  167. sudo mkdir -p /etc/X11/xorg.conf.d
  168. sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf <<-EOF > /dev/zero
  169.     Section "InputClass"
  170.     Identifier "system-keyboard"
  171.     MatchIsKeyboard "on"
  172.     Option "XkbLayout" "$country"
  173.     Option "XkbVariant" "$variant"
  174.     EndSection
  175.     EOF
  176. }
  177.  
  178.  
  179. echo "Do you want to modify the xorg keyboard"
  180. echo ""
  181. select yn in "Yes" "No"; do
  182.     case $yn in
  183.         Yes ) x11edit; break;;
  184.         No ) break;;
  185.     esac
  186. done
  187.  
  188. echo "Enabling the cups printing service"
  189. echo ""
  190. sleep 3
  191. sudo systemctl enable cups-browsed.service > /dev/null 2>&1
  192.  
  193. echo "Adding current user to the printing admin group"
  194. echo ""
  195. sleep 3
  196. sudo usermod "$USER" -aG sys
  197.  
  198. echo "Configuring Keep Arch Linux Up-to-date"
  199. echo ""
  200. sleep 3
  201. mkdir "$XDG_CONFIG_HOME"/kalu
  202. cat <<-EOF > "$XDG_CONFIG_HOME"/kalu/kalu.conf
  203.     [options]
  204.     PacmanConf = /etc/pacman.conf
  205.     NotificationIcon = KALU
  206.     NotificationIconSize = 20
  207.     Interval = 60
  208.     Timeout = DEFAULT
  209.     AutoChecks = NEWS UPGRADES WATCHED AUR WATCHED_AUR
  210.     ManualChecks = NEWS UPGRADES WATCHED AUR WATCHED_AUR
  211.     CmdLineLink = xdg-open '\$URL'
  212.     CheckPacmanConflict = 1
  213.     UpgradeAction = KALU
  214.     ConfirmPostSysUpgrade = 1
  215.     CmdLineAur = xfce4-terminal -e "pacaur -Syua"
  216.     SyncDbsInTooltip = 1
  217.     OnSglClick = CHECK
  218.     OnDblClick = SYSUPGRADE
  219.     OnMdlClick = LAST_NOTIFS
  220.     OnSglClickPaused = SAME_AS_ACTIVE
  221.     OnDblClickPaused = SAME_AS_ACTIVE
  222.     OnMdlClickPaused = SAME_AS_ACTIVE
  223.     [template-upgrades]
  224.     TitleSce = DEFAULT
  225.     PackageSce = DEFAULT
  226.     SepSce = DEFAULT
  227.     [template-watched]
  228.     TitleSce = DEFAULT
  229.     PackageSce = FALLBACK
  230.     SepSce = FALLBACK
  231.     [template-aur]
  232.     TitleSce = DEFAULT
  233.     PackageSce = DEFAULT
  234.     SepSce = FALLBACK
  235.     [template-aur-not-found]
  236.     TitleSce = DEFAULT
  237.     PackageSce = DEFAULT
  238.     SepSce = FALLBACK
  239.     [template-watched-aur]
  240.     TitleSce = DEFAULT
  241.     PackageSce = FALLBACK
  242.     SepSce = FALLBACK
  243.     [template-news]
  244.     TitleSce = DEFAULT
  245.     PackageSce = DEFAULT
  246.     SepSce = FALLBACK
  247.     EOF
  248.  
  249. echo "Adding current user to the Keep Arch Linux Up-to-date group"
  250. echo ""
  251. sleep 3
  252. sudo usermod "$USER" -aG kalu
  253.  
  254. echo "Editing openbox autostart configuration"
  255. echo ""
  256. sleep 3
  257. mkdir -p "$XDG_CONFIG_HOME"/autostart
  258. mkdir -p "$XDG_CONFIG_HOME"/openbox
  259. cat <<-EOF > "$XDG_CONFIG_HOME"/openbox/autostart
  260.     #
  261.     # These things are run when an Openbox X Session is started.
  262.     # You may place a similar script in $HOME/.config/openbox/autostart
  263.     # to run user-specific things.
  264.     #
  265.  
  266.     # If you want to use GNOME config tools...
  267.     #
  268.     #if test -x /usr/lib/openbox/gnome-settings-daemon >/dev/null; then
  269.     #  /usr/lib/openbox/gnome-settings-daemon &
  270.     #elif which gnome-settings-daemon >/dev/null 2>&1; then
  271.     #  gnome-settings-daemon &
  272.     #fi
  273.  
  274.     # If you want to use XFCE config tools...
  275.     #
  276.     #xfce-mcs-manager &
  277.     nm-applet &
  278.     thunar --daemon &
  279.     xfce4-panel &
  280.     xfdesktop &
  281.     xcompmgr &
  282.     opensnap &
  283.     xscreensaver -no-splash &
  284.     # VBoxClient-all &
  285.     kalu &
  286.     numlockx &
  287.     EOF
  288.  
  289. function copyconf {
  290.     echo "Remeber to add the new users to the Keep Arch Linux"
  291.     echo "Up-to-date group"
  292.     echo ""
  293.     sleep 3
  294.     sudo cp -r "$XDG_CONFIG_HOME" /etc/skel/
  295.     sudo find /etc/skel/.config -type d -exec chmod 755 {} \;
  296.     sudo find /etc/skel/.config -type f -exec chmod 644 {} \;
  297. }  
  298.  
  299.  
  300. echo "Do you want to use the current autostart, mimeapps and Keep Arch Linux"
  301. echo "Up-to-date config for all new users (recommend)?"
  302. echo ""
  303. select yn in "Yes" "No"; do
  304.     case $yn in
  305.         Yes ) copyconf; break;;
  306.         No ) break;;
  307.     esac
  308. done
  309.  
  310. cat <<-EOF > /tmp/systctl
  311.     #!/bin/bash
  312.     echo "Creating 99-systctl"
  313.     echo ""
  314.     touch /etc/sysctl.d/99-sysctl.conf
  315.     echo "Changing swappiness to 1..."
  316.     echo ""
  317.     sleep 3
  318.     echo "vm.swappiness=1" >> /etc/sysctl.d/99-sysctl.conf
  319.     echo "Changing vfs cache pressure to 50..."
  320.     echo ""
  321.     sleep 3
  322.     echo "vm.vfs_cache_pressure=50" >> /etc/sysctl.d/99-sysctl.conf
  323.     echo "Changing dirty background bytes to 16777216..."
  324.     echo ""
  325.     sleep 3
  326.     echo "vm.dirty_background_bytes=16777216" >> /etc/sysctl.d/99-sysctl.conf
  327.     echo "Changing dirty bytes to 50331648..."
  328.     echo ""
  329.     sleep 3
  330.     echo "vm.dirty_bytes=50331648" >> /etc/sysctl.d/99-sysctl.conf
  331.     EOF
  332. chmod +x /tmp/systctl
  333.  
  334. sudo /tmp/systctl
  335.  
  336. echo "Enabling sddm Network Manager and ufw"
  337. systemctl enable NetworkManager sddm ufw > /dev/null 2>&1
  338.  
  339. echo "Basic system configuration is complete, though a reboot is needed."
  340. echo "If you are running a VirtualBox Client, please uncomment"
  341. echo "'VBoxClient-all' & in $XDG_CONFIG_HOME/openbox/autostart"
  342. echo "and/or /etc/skel/.config/openbox/autostart before you reboot"
  343. echo "your system."
  344. echo ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement