Improved install desktop script

This commit is contained in:
Dimitar Gamishev 2018-12-05 15:35:30 +02:00
parent d698f9c39e
commit 09a0b0c1c4

@ -1,17 +1,19 @@
#!/bin/bash #!/bin/bash
# by @ayufan-pine64/linux-build
# https://github.com/ayufan-pine64/linux-build/blob/master/LICENSE.txt
# adopted hehopmajieh@debian.bg
set -e set -e
DESKTOP="$1" DESKTOP="$1"
if [ -z "$DESKTOP" ]; then if [ -z "$DESKTOP" ]; then
echo "Usage: $0 <mate|i3>" echo "Usage: $0 <mate|i3|gnome|xfce4|lxde>"
exit 1 exit 1
fi fi
DISTRO="" DISTRO=""
if hash apt-get 2>/dev/null; then if hash apt-get 2>/dev/null; then
DISTRO=debian DISTRO=$(lsb_release -i -s)
fi fi
if [ -z "$DISTRO" ]; then if [ -z "$DISTRO" ]; then
@ -27,36 +29,105 @@ fi
# Default packages. # Default packages.
PACKAGES=( PACKAGES=(
xserver-xorg-video-fbturbo xserver-xorg-video-fbturbo
# we are not ready for drm yet :)
# xserver-xorg-video-armsoc-sunxi
# libmali-sunxi-utgard0-r6p0
# mesa-utils-extra
# glmark2-es2
libvdpau-sunxi1 libvdpau-sunxi1
vdpauinfo vdpauinfo
mplayer
smplayer
smplayer-themes
smtube
chromium-browser
) )
# Additional packages
PACKAGES+=(
xserver-xorg-input-all
xfonts-base
rxvt-unicode-lite
suckless-tools
network-manager
pulseaudio
)
case $DISTRO in
Ubuntu)
PACKAGES+=(
chromium-browser
firefox
)
;;
Debian)
PACKAGES+=(
chromium
chromium-widevine
)
;;
*)
echo "Error: unsupported desktop environment $DESKTOP-$DISTRO"
exit 2
;;
esac
# Add packages based on desktop selection. # Add packages based on desktop selection.
case $DESKTOP in case $DESKTOP-$DISTRO in
mate) mate-Ubuntu)
PACKAGES+=( PACKAGES+=(
ubuntu-mate-core ubuntu-mate-core
ubuntu-mate-desktop
ubuntu-mate-lightdm-theme
ubuntu-mate-wallpapers-xenial
smplayer
mplayer
lightdm lightdm
) )
;; ;;
i3|i3wm) mate-Debian)
PACKAGES+=(
mate-desktop-environment
mate-desktop-environment-extras
desktop-base
lightdm
)
;;
gnome-Ubuntu)
PACKAGES+=(
ubuntu-gnome-desktop
ubuntu-gnome-wallpapers-xenial
)
;;
gnome-Debian)
PACKAGES+=(
gnome
desktop-base
)
;;
i3-Ubuntu|i3-Debian)
PACKAGES+=( PACKAGES+=(
xserver-xorg-input-all
xfonts-base
slim
rxvt-unicode-lite
i3 i3
i3status i3status
i3lock i3lock
suckless-tools slim
network-manager )
pulseaudio ;;
xfce4-Ubuntu|xfce4-Debian)
PACKAGES+=(
xfce4
xfce4-goodies
lightdm
lightdm-gtk-greeter
)
;;
lxde-Ubuntu|lxde-Debian)
PACKAGES+=(
lxde
lxdm
) )
;; ;;
@ -68,36 +139,7 @@ esac
# Install. # Install.
apt -y update apt -y update
apt -y --no-install-recommends install ${PACKAGES[@]} apt -y --install-recommends install ${PACKAGES[@]}
# Configuration.
mkdir -p /etc/X11/xorg.conf.d
# Make X11 use fbturbo driver.
cat > "/etc/X11/xorg.conf.d/40-pine64-fbturbo.conf" <<EOF
Section "Device"
Identifier "Allwinner A10/A13 FBDEV"
Driver "fbturbo"
Option "fbdev" "/dev/fb0"
Option "SwapbuffersWait" "true"
EndSection
EOF
# Add configuration for Pinebook touchpad so it is usable.
#cat > "/etc/X11/xorg.conf.d/50-pine64-pinebook-touchpad.conf" <<EOF
#Section "InputClass"
# Identifier "HAILUCK CO.,LTD USB KEYBOARD"
# MatchIsPointer "1"
# MatchDevicePath "/dev/input/event*"
#
# Option "AccelerationProfile" "2"
# Option "AdaptiveDeceleration" "1"
# Option "ConstantDeceleration" "2.4" # Pinebook 14"
#Option "ConstantDeceleration" "1.2" # Pinebook 11"
#EndSection
#EOF
# Kill parport module loading, not available on arm64. # Kill parport module loading, not available on arm64.
if [ -e "/etc/modules-load.d/cups-filters.conf" ]; then if [ -e "/etc/modules-load.d/cups-filters.conf" ]; then
@ -109,36 +151,14 @@ if [ -e "/etc/pulse/default.pa" ]; then
sed -i 's/load-module module-udev-detect$/& tsched=0/g' /etc/pulse/default.pa sed -i 's/load-module module-udev-detect$/& tsched=0/g' /etc/pulse/default.pa
fi fi
# Enable VDPAU_SUNXI globally.
if [ ! -e "/etc/X11/Xsession.d/30pine64-vdpau-sunxi" ]; then
cat > "/etc/X11/Xsession.d/30pine64-vdpau-sunxi" <<EOF
export VDPAU_DRIVER=sunxi
EOF
fi
# Create directory if not present
[ -d /etc/chromium-browser ] || mkdir /etc/chromium-browser
# Set some default parameters for chromium.
if [ ! -e "/etc/chromium-browser/default" ]; then
cat > "/etc/chromium-browser/default" <<EOF
# Default settings for chromium-browser. This file is sourced by /bin/sh from
# /usr/bin/chromium-browser
# Options to pass to chromium-browser
CHROMIUM_FLAGS="\
--disable-smooth-scrolling \
--disable-low-res-tiling \
--enable-low-end-device-mode \
--num-raster-threads=4 \
--profiler-timing=0 \
--disable-composited-antialiasing \
"
EOF
fi
# Desktop dependent post installation. # Desktop dependent post installation.
#case $DESKTOP in #case $DESKTOP in
# mate)
# # Change default wallpaper
# dpkg-divert --divert /usr/share/backgrounds/ubuntu-mate-common/Ubuntu-Mate-Cold-stock.jpg --rename /usr/share/backgrounds/ubuntu-mate-common/Ubuntu-Mate-Cold.jpg
# ln -s /usr/share/backgrounds/ubuntu-mate-pinebook/Pinebook-Wallpaper-6.jpg /usr/share/backgrounds/ubuntu-mate-common/Ubuntu-Mate-Cold.jpg
# ;;
#
# i3|i3wm) # i3|i3wm)
# if [ ! -d /usr/share/slim/themes/pine64 ]; then # if [ ! -d /usr/share/slim/themes/pine64 ]; then
# cp -ra /usr/share/slim/themes/default /usr/share/slim/themes/pine64 # cp -ra /usr/share/slim/themes/default /usr/share/slim/themes/pine64
@ -151,6 +171,73 @@ fi
# *) # *)
# ;; # ;;
#esac #esac
mkdir -p /etc/X11/xorg.conf.d
# Make X11 use fbturbo driver.
cat > "/etc/X11/xorg.conf.d/99-teres-disp.conf" <<EOF
Section "ServerLayout"
Identifier "MultyDisplay"
Screen 0 "LCD"
Screen 1 "HDMI" RightOf "LCD"
Option "Xinerama" "on"
# Option "Clone" "off"
EndSection
EOF
cat > "/etc/X11/xorg.conf.d/20-teres-lcd.conf" <<EOF
Section "Device"
Identifier "TERES-LCD"
Driver "fbturbo"
Option "fbdev" "/dev/fb0"
Option "SwapbuffersWait" "true"
EndSection
Section "Monitor"
Identifier "LCD-TERES"
EndSection
Section "Screen"
Identifier "LCD"
Device "TERES-LCD"
Monitor "LCD-TERES"
Option "Primary" "true"
SubSection "Display"
Modes "1366x768"
ViewPort 0 0
Virtual 1366 768
EndSubSection
EndSection
EOF
cat > "/etc/X11/xorg.conf.d/30-teres-hdmi.conf" <<EOF
Section "Device"
Identifier "TERES-HDMI"
Driver "fbturbo"
Option "fbdev" "/dev/fb1"
Option "SwapbuffersWait" "true"
EndSection
Section "Monitor"
Identifier "HDMI-TERES"
EndSection
Section "Screen"
Identifier "HDMI"
Device "TERES-HDMI"
Monitor "HDMI-TERES"
SubSection "Display"
Modes "1920x1080"
ViewPort 0 1
Virtual 1920 1080
EndSubSection
EndSection
EOF
echo "Enabling vdpau via Xsession"
cat > "/etc/X11/Xsession.d/30teres-vdpau-sunxi" <<EOF
if [ -d /sys/module/disp ]; then
export VDPAU_DRIVER=sunxi
fi
end
EOF
echo echo
echo "Done - $DESKTOP installed - you should reboot now." echo "Done - $DESKTOP installed - you should reboot now."