|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -e |
| 4 | + |
| 5 | +DESKTOP="$1" |
| 6 | + |
| 7 | +if [ -z "$DESKTOP" ]; then |
| 8 | + echo "Usage: $0 <mate|i3>" |
| 9 | + exit 1 |
| 10 | +fi |
| 11 | + |
| 12 | +DISTRO="" |
| 13 | +if hash apt-get 2>/dev/null; then |
| 14 | + DISTRO=debian |
| 15 | +fi |
| 16 | + |
| 17 | +if [ -z "$DISTRO" ]; then |
| 18 | + echo "This script requires a Debian based Linux distribution." |
| 19 | + exit 1 |
| 20 | +fi |
| 21 | + |
| 22 | +if [ "$(id -u)" -ne "0" ]; then |
| 23 | + echo "This script requires root." |
| 24 | + exit 1 |
| 25 | +fi |
| 26 | + |
| 27 | +# Default packages. |
| 28 | +PACKAGES=( |
| 29 | + xserver-xorg-video-fbturbo |
| 30 | + libvdpau-sunxi1 |
| 31 | + vdpauinfo |
| 32 | +) |
| 33 | + |
| 34 | +# Add packages based on desktop selection. |
| 35 | +case $DESKTOP in |
| 36 | + mate) |
| 37 | + PACKAGES+=( |
| 38 | + ubuntu-mate-core |
| 39 | + ubuntu-mate-desktop |
| 40 | + ubuntu-mate-lightdm-theme |
| 41 | + ubuntu-mate-wallpapers-xenial |
| 42 | + lightdm |
| 43 | + ) |
| 44 | + ;; |
| 45 | + |
| 46 | + i3|i3wm) |
| 47 | + PACKAGES+=( |
| 48 | + xserver-xorg-input-all |
| 49 | + xfonts-base |
| 50 | + slim |
| 51 | + rxvt-unicode-lite |
| 52 | + i3 |
| 53 | + i3status |
| 54 | + i3lock |
| 55 | + suckless-tools |
| 56 | + network-manager |
| 57 | + pulseaudio |
| 58 | + ) |
| 59 | + ;; |
| 60 | + |
| 61 | + *) |
| 62 | + echo "Error: unsupported desktop environment $DESKTOP" |
| 63 | + exit 2 |
| 64 | + ;; |
| 65 | +esac |
| 66 | + |
| 67 | +# Install. |
| 68 | +apt -y update |
| 69 | +apt -y --no-install-recommends install ${PACKAGES[@]} |
| 70 | + |
| 71 | +# Kill parport module loading, not available on arm64. |
| 72 | +if [ -e "/etc/modules-load.d/cups-filters.conf" ]; then |
| 73 | + echo "" >/etc/modules-load.d/cups-filters.conf |
| 74 | +fi |
| 75 | + |
| 76 | +# Disable Pulseaudio timer scheduling which does not work with sndhdmi driver. |
| 77 | +if [ -e "/etc/pulse/default.pa" ]; then |
| 78 | + sed -i 's/load-module module-udev-detect$/& tsched=0/g' /etc/pulse/default.pa |
| 79 | +fi |
| 80 | + |
| 81 | +# Desktop dependent post installation. |
| 82 | +case $DESKTOP in |
| 83 | + i3|i3wm) |
| 84 | + if [ ! -d /usr/share/slim/themes/pine64 ]; then |
| 85 | + cp -ra /usr/share/slim/themes/default /usr/share/slim/themes/pine64 |
| 86 | + wget -O /usr/share/slim/themes/pine64/background.png \ |
| 87 | + https://github.com/longsleep/build-pine64-image/raw/master/bootlogo/bootlogo-pine64-1366x768.png |
| 88 | + sed -i "s/^current_theme(.*)/current_theme pine64/g" /etc/slim.conf |
| 89 | + fi |
| 90 | + ;; |
| 91 | + |
| 92 | + *) |
| 93 | + ;; |
| 94 | +esac |
| 95 | + |
| 96 | +echo |
| 97 | +echo "Done - $DESKTOP installed - you should reboot now." |
0 commit comments