Pimp my Elementary OS 0.4 (Loki) – Teil 2

Bash, ElementaryOS, Fun

Hier noch eine verbesserte Form des alten Skriptes:

#!/bin/bash
##
## Usage: loki_post_install [options]
##
## Removes unnecessary and add usefull software to a fresh installed Elementary OS 0.4 (Loki).
## Must be run as root.
##
## Options:
##  -h, --help      Display this message.
##

main() {
while [ $# -gt 0 ]; do
case $1 in
(-h|--help) usage;;
(--) shift; break;;
(*) break;;
esac
done
if [ $(whoami) != "root" ]; then
echo "This program must be run as root."
exit 1
fi
software
}
usage(){
[ "$*" ] && echo "$0: $*"
sed -n '/^##/,/^$/s/^## \{0,1\}//p' "$0"
exit 2
}
msg() {
(echo; echo \*\*\* $1 \*\*\*; echo)
}
software() {
msg "Prepare system"
apt update && apt upgrade -y && apt autoremove -y && apt autoclean -y
msg "Remove software"
apt purge maya-calendar pantheon-mail appcenter simple-scan -y
msg "Install software"
apt install zip unzip rar unrar gnome-disk-utility firefox lilypond fluid-soundfont-gm timidity libav-tools openjdk-8-jdk-headless -y

vbox=`dmidecode -t system | grep -i 'virtualbox' | wc -l`
if [ $vbox -gt 0 ]; then
msg "Install & configure additional software for VirtualBox"
apt install virtualbox-guest-additions-iso virtualbox-guest-utils

if [ $SUDO_USER == "" ]; then
adduser $USER vboxsf
else
adduser $SUDO_USER vboxsf
fi
fi

msg "Clean up"
apt update && apt upgrade -y && apt autoremove -y && apt autoclean -y
}

main "$@"

Feedback welcome!

Pimp my Elementary OS 0.4 (Loki)

Bash, ElementaryOS, Fun

Also das neue schicke Elementary OS ist ja nun verfügbar, jedoch fehlt hier und da das ein oder andere wichtige Tool für mich. Und da ich den Laptop nur als Zweitrechner nutze brauche ich ja kein extra Mailprogramm geschweige denn ein Scanprogramm…

Lange Rede kurzer Sinn: Einiges musste  weg, einiges noch hinzu kommen damit ich mit dem Endergebnis so richtig zufrieden bin…

#!/bin/bash
##
## Usage: loki_post_install [options]
##
## Removes unnecessary and add usefull software to a fresh installed Elementary OS 0.4 (Loki).
## Must be run as root.
##
## Options:
##   -h, --help    Display this message.
##   -d            Display debug information.
##

DBG=0;

main() {
while [ $# -gt 0 ]; do
case $1 in
(-d) DBG=1;shift;;
(-h|--help) usage 2>&1;;
(--) shift; break;;
(-*) usage "$1: unknown option";;
(*) break;;
esac
done
if [[ $(whoami) != "root" ]]; then
echo "This program must be run as root." >&2
exit 1
fi
software
}

usage() {
[ "$*" ] && echo "$0: $*"
sed -n '/^##/,/^$/s/^## \{0,1\}//p' "$0"
exit 2
} 2>/dev/null

msg() {
if [ $DBG -eq 1 ]; then
(echo; echo \*\*\* $1 \*\*\*; echo)
fi
}

software() {
msg "Prepare system"
apt update -y && apt upgrade -y && apt autoremove -y
msg "Remove software"
apt purge maya-calendar pantheon-mail appcenter simple-scan -y
msg "Install software"
apt install zip unzip rar unrar gnome-disk-utility firefox lilypond frescobaldi fluid-soundfont-gm timidity -y
msg "Clean up"
apt update -y && apt upgrade -y && apt autoremove -y
}

main "$@"