Skip to content
Snippets Groups Projects
Commit 4210dfa7 authored by Gustav Geier's avatar Gustav Geier
Browse files

Updated scripts

parent ffb8224f
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
set -e set -e
#options for GUI are kdialog zenity no
if [ -z "$GUI" ]; then
GUI=kdialog
fi
MY_DIR="$( readlink -f "$( dirname "${BASH_SOURCE[0]}" )" )" MY_DIR="$( readlink -f "$( dirname "${BASH_SOURCE[0]}" )" )"
HIVE_DIR="$MY_DIR/../hive/" #we assume here that the LIP install stick is mounted at /media/MultiBoot... better idea? HIVE_DIR="$MY_DIR/../hive/" #we assume here that the LIP install stick is mounted at /media/MultiBoot... better idea?
...@@ -100,25 +105,6 @@ preinstalledpkgs() { ...@@ -100,25 +105,6 @@ preinstalledpkgs() {
done done
} }
askyesno() {
while true
do
read -n1 -p "$1 [j,n]"
echo
case "$REPLY" in
y|Y|j|J) return 0;;
n|N) return 1;;
*) echo 'Antworte bitte mit "j" für "Ja" oder "n" für "Nein"' ;;
esac
done
}
pressenter() {
echo $@
echo "Drücke <Enter> um fortzufahren (Strg-C zum Abbrechen)"
read
}
bright() { bright() {
# gruen # gruen
echo -ne "\033[1m$@\033[0m" echo -ne "\033[1m$@\033[0m"
...@@ -138,6 +124,27 @@ warn() { ...@@ -138,6 +124,27 @@ warn() {
echo -e "\033[0m" # normal echo -e "\033[0m" # normal
} }
case "$GUI" in
no)
askyesno() {
while true
do
read -n1 -p "$1 [j,n]"
echo
case "$REPLY" in
y|Y|j|J) return 0;;
n|N) return 1;;
*) echo 'Antworte bitte mit "j" für "Ja" oder "n" für "Nein"' ;;
esac
done
}
pressenter() {
echo $@
echo "Drücke <Enter> um fortzufahren (Strg-C zum Abbrechen)"
read
}
err() { err() {
echo echo
echo -ne "\033[31;7m" # rot echo -ne "\033[31;7m" # rot
...@@ -157,10 +164,8 @@ install_pkgs() { ...@@ -157,10 +164,8 @@ install_pkgs() {
ok "Keine Packete installiert" ok "Keine Packete installiert"
fi fi
} }
;;
if [ -z "$NOGUI" ]; then zenity)
#overwrite functions with graphical replacements
askyesno() { askyesno() {
zenity --question --text "$@" 2> /dev/null zenity --question --text "$@" 2> /dev/null
} }
...@@ -172,26 +177,55 @@ err() { ...@@ -172,26 +177,55 @@ err() {
pressenter() { pressenter() {
zenity --info --text "$@" 2> /dev/null zenity --info --text "$@" 2> /dev/null
} }
install_pkgs() {
local pkglist=$3[@]
INSTALL=$(zenity --list --title "$1" --text "$2" --checklist --separator=" " --width=786 --height=400 --column "Installieren?" --column "Packet" --column "Beschreibung" "${!pkglist}" 2> /dev/null || true)
if [ -n "$INSTALL" ]; then
apt-install $INSTALL
ok "$INSTALL installiert"
else
ok "Keine Packete installiert"
fi fi
# Verbose error trapping
showerr() {
err "Bei der Installation ist ein Fehler aufgetreten. Frage einen Helfer."
} }
trap showerr ERR ;;
kdialog)
apt-install() { askyesno() {
apt-get install --quiet -y --force-yes $@ kdialog --yesno "$@" 2> /dev/null
} }
err() {
kdialog --error "$@" 2> /dev/null
}
if [ -z "$NOGUI" ]; then pressenter() {
kdialog --msgbox "$@" 2> /dev/null
#graphical installations }
install_pkgs() { install_pkgs() {
local pkglist=$3[@] local pkglist=$3[@]
INSTALL=$(zenity --list --title "$1" --text "$2" --checklist --separator=" " --width=786 --height=400 --column "Installieren?" --column "Packet" --column "Beschreibung" "${!pkglist}" 2> /dev/null || true) local nlist=""
local n=0
local tag=""
local text=""
local use=""
for e in $pkglist; do
case n in
0)
use="$e"
n=1
;;
1)
tag="$e"
n=2
;;
2)
text="$e"
nlist="$nlist $tag \"$tag: $text\" $use"
n=0
;;
esac
done
INSTALL=$(kdialog --width=786 --height=400 --title "$1" --checklist $nlist 2> /dev/null || true)
if [ -n "$INSTALL" ]; then if [ -n "$INSTALL" ]; then
apt-install $INSTALL apt-install $INSTALL
...@@ -200,8 +234,22 @@ install_pkgs() { ...@@ -200,8 +234,22 @@ install_pkgs() {
ok "Keine Packete installiert" ok "Keine Packete installiert"
fi fi
} }
;;
*)
echo "Ungültige GUI Option '$GUI'. Möglich Werte sind 'kdialog', 'zenity' oder 'no'"
exit 1
;;
esac
fi # Verbose error trapping
showerr() {
err "Bei der Installation ist ein Fehler aufgetreten. Frage einen Helfer."
}
trap showerr ERR
apt-install() {
apt-get install --quiet -y --force-yes $@
}
install_common() { install_common() {
install_pkgs "Allg. Packete installieren?" "Programme, die der OSAK/die ALUG für sinnvoll hält, sind bereits zur Installation vorselektiert.\nWenn du keine Packete aus der Liste installieren willst, einfach Abbrechen.\nBitte beachten: Das LIP-Script deinstalliert keine Packete, insbesondere also keine Packete die in einem früheren Lauf aktiv waren,\nund diesmal nicht ausgewählt sind!" COMMON_PKGS install_pkgs "Allg. Packete installieren?" "Programme, die der OSAK/die ALUG für sinnvoll hält, sind bereits zur Installation vorselektiert.\nWenn du keine Packete aus der Liste installieren willst, einfach Abbrechen.\nBitte beachten: Das LIP-Script deinstalliert keine Packete, insbesondere also keine Packete die in einem früheren Lauf aktiv waren,\nund diesmal nicht ausgewählt sind!" COMMON_PKGS
......
...@@ -3,6 +3,9 @@ set -e ...@@ -3,6 +3,9 @@ set -e
#find device #find device
DEV="$(blkid -t "LABEL=MultiBoot" -o device | head -n1 || echo '')" DEV="$(blkid -t "LABEL=MultiBoot" -o device | head -n1 || echo '')"
if [ -z "$DEV" ]; then
DEV="$(blkid -t "LABEL=MULTIBOOT" -o device | head -n1 || echo '')"
fi
PS3="[1,2,3]<Enter>: " PS3="[1,2,3]<Enter>: "
while [ -z "$DEV" ]; do while [ -z "$DEV" ]; do
...@@ -14,6 +17,9 @@ while [ -z "$DEV" ]; do ...@@ -14,6 +17,9 @@ while [ -z "$DEV" ]; do
case $i in case $i in
"Stick ist jetzt gesteckt") "Stick ist jetzt gesteckt")
DEV="$(blkid -t "LABEL=MultiBoot" -o device | head -n1 || echo '')" DEV="$(blkid -t "LABEL=MultiBoot" -o device | head -n1 || echo '')"
if [ -z "$DEV" ]; then
DEV="$(blkid -t "LABEL=MULTIBOOT" -o device | head -n1 || echo '')"
fi
;; ;;
"Ohne Stick weitermachen") "Ohne Stick weitermachen")
DEV='-nomount-' DEV='-nomount-'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment