Skript, um das Installationsskript ›installiere_neo‹ zu erstellen

This commit is contained in:
pascal 2008-12-24 14:53:51 +00:00
parent c968c58ce4
commit 2f642c6f78
3 changed files with 370 additions and 0 deletions

View File

@ -0,0 +1,27 @@
cat installation.1
echo "#neo: xmodmap --- Beginn"
cat ~/neo/svn-Arbeitsverzeichnis/neo/linux/xmodmap/neo_de.xmodmap
echo "#neo: xmodmap --- Ende"
echo "#neo: console --- Beginn"
cat ~/neo/svn-Arbeitsverzeichnis/neo/linux/console/neo.map
echo "#neo: console --- Ende"
echo "#neo: asdf --- Beginn"
cat ~/neo/svn-Arbeitsverzeichnis/neo/linux/bin/asdf
echo "#neo: asdf --- Ende"
echo "#neo: uiae --- Beginn"
cat ~/neo/svn-Arbeitsverzeichnis/neo/linux/bin/uiae
echo "#neo: uiae --- Ende"
echo "#neo: neorc --- Beginn"
cat ~/neo/svn-Arbeitsverzeichnis/neo/linux/bin/erzeuge_installation/neo.conf.installation
echo "#neo: neorc --- Ende"
echo "#neo: profile.neo --- Beginn"
echo
echo "# NEO:"
echo "asdf # mit einem # am Zeilenanfang bleibt QWERTZ das Standardlayout, sonst ist es NEO"
echo "#neo: profile.neo --- Ende"
echo "#neo: profile.qwertz --- Beginn"
echo
echo "# NEO:"
echo "# asdf # mit einem # am Zeilenanfang bleibt QWERTZ das Standardlayout, sonst ist es NEO"
echo "#neo: profile.qwertz --- Ende"
echo

View File

@ -0,0 +1,290 @@
#!/bin/bash
# Copyright 2008 Pascal Hauck <pascal.hauck@web.de>
# Distributed under the terms of the GNU General Public License v3
# ======= Installation =======
# Um NEO auf Ihrem System zu (dauerhaft) zu installieren, genügt es, dieses Skript auszuführen
# z.B. in der Konsole die folgenden beiden Zeilen eingeben:
# chmod u+x installation
# ./installation
# Nun ist NEO auf Ihrem System dauerhaft installier
# Ein Wechsel zurück zu QWERTZ ist jederzeit mit uiae leicht möglich
# Wenn NEO nicht automatisch nach dem Login gestartet werden soll, genügt es, vor die Zeile, die mit
# asdf # mit einem # am Zeilenanfang
# beginnt und sich in der Datei $HOME/.profile befinden, ein # zu setzen
# ==============================
# ======= Deinstallation =======
# Um NEO wieder zu deinstallieren, kann das Skript installiere_neo ein weiteres Mal aufgerufen werden
# ==============================
# ======= Bemerkungen ==========
# Dieses Skript ist eine rudimentäre Installation. Derzeit gibt es keine Konfigurationsmöglichkeit.
# Es wird immer das Standardverzeichnis $HOME/neo verwendet
# Es gibt keine graphische Installation
# Dennoch kann dieses Skrip helfen, NEO auf eine einfache Weise zu installieren.
# Dieses Skript wird mit der Zeit verbessert werden.
# ==============================
# colours in the Bash
B="\033[30m"
R="\033[31m"
G="\033[32m"
datei() { # cut files from the complete file installiere_neo
grep -A10000 "#neo: $1 --- Beginn" installation | grep -B10000 "#neo: $1 --- Ende" | grep -v "#neo:"
}
erzeuge() { # create directories, files and entries
case $1 in
d) # directory
if [ -d $2 ] # if already exists
then
echo -e "Das Verzeichnis ${R}$2${B} gibt es bereits wird verwendet…"
else
echo -e "Erstelle $2"
mkdir $2 # create
fi
;;
f) # file
if [ -f $3 ] # if already exists
then
echo -e "Die Datei ${R}$3${B} gibt es bereits soll die bestehende Datei überschrieben werden? \c"; read -p "[J,N] " -e overwrite
if [ "$overwrite" = "J" ] # overwrite?
then
echo "Datei $3 wird überschrieben!"
rm -f $3 # remove if user wants to overwrite
else
echo -e "Datei ${R}$3${B} gibt es schon → Installation abgebrochen"
exit
fi
fi
echo "Erstelle Datei $3" # create
datei $2 > $3
;;
l) # soft link
if [ -d $HOME/bin/ ] # $HOME/bin has to exist!
then
echo "Verzeichnis $HOME/bin/ gefunden"
else
echo -e "Verzeichnis ${R}$HOME/bin${B} wird erwartet, ist aber nicht vorhanden"
echo "Außerdem wird erwartet, dass /$HOME/bin in der Umgebungsvariable \$PATH ist"
echo "Istallation wird abgebrochen."
exit
fi
if [ -f $HOME/bin/$2 ] # if already exists
then
echo -e "Datei ${R}$HOME/bin/$2${B} gibt es bereits soll die bestehende Datei überschrieben werden? \c"; read -p "[J,N] " -e overwrite
if [ "$overwrite" = "J" ] # overwrite?
then
echo "Datei $2 wird überschrieben!"
rm -f $HOME/bin/$2 # remove if user wants to overwrite
else
echo -e "Datei ${R}$2${B} gibt es schon → Installation abgebrochen"
exit
fi
fi
echo "Erstelle Link $HOME/bin/$2"
ln -s $HOME/neo/$2 $HOME/bin # create
;;
esac
}
entferne(){ # remove files for uninstall option
echo "Entferne $1"
rm $1 || echo -e "${R}Konnte die Datei $1 nicht entfernen!${B}"
}
deinstall() { #remove all directories, files and entries made by installiere_neo
echo
echo
rmfromprofile
entferne $HOME/.neorc
entferne $HOME/bin/uiae
entferne $HOME/neo/uiae
entferne $HOME/bin/asdf
entferne $HOME/neo/asdf
entferne $HOME/neo/neo.map
entferne $HOME/neo/neo_de.xmodmap
echo "Entferne $HOME/neo/"
rmdir $HOME/neo/ || echo -e "${R}Konnte das Verzeichenis $HOME/neo/ nicht entfernen!${B}"
}
rmfromprofile() { # remove the entry in $HOME/.profile
grep -v "^\# NEO:$" $HOME/.profile | grep -v "asdf \# mit" > $HOME/profile.neo.tmp
rm /$HOME/.profile
mv $HOME/profile.neo.tmp $HOME/.profile
}
# *** main program ***
clear
echo
echo " *** NEO Ergonomie und Zeichenvielfalt ***"
echo
echo
echo " Ihr System wird untersucht…"
echo
# check for an existing neo configuration
if [ -f "${NEO_CONFIG}" ]; then
. "${NEO_CONFIG}" || die "Failed to source ${NEO_CONFIG}"
elif [ -f "${HOME}"/.neorc ]; then
. "${HOME}"/.neorc || die "Failed to source ${HOME}/.neorc"
elif [ -f /etc/neo.conf ]; then
. /etc/neo.conf || die "Failed to source /etc/neo.conf"
else
# no configuration file found → install NEO
echo "Bislang gibt es kein vollständig konfiguriertes NEO auf Ihrem System"
echo
echo "Sie haben folgende Möglichkeiten:"
echo
echo " [1] NEO nur testen"
echo " Sie haben die Möglichkeit, NEO zu Testen, ihre Standardbelegung (in der Regel QWERTZ) bleibt erhalten"
echo
echo
echo " [2] NEO als Standardbelegung"
echo " Mit dieser Option wird NEO die neue Standardbelegung für diesen Benutzer und nach (nicht vor!) dem"
echo " Login automatisch aktiviert"
echo
echo
echo -e " Wenn ${G}installiere_neo${B} ein weiteres Mal aufgerufen wird, haben weitere Optionen z.B. die Deinstallation von NEO"
echo
installoption=""
while [ ! $installoption ] # choose between QWERTZ or NEO as standard
do # switch with asdf and uiae
echo
read -p "Wählen Sie eine Option [1,2]: " -e installoption
case $installoption in
2)
echo
echo "Nach dem Login wird NEO die Standardbelegung sein."
echo -e "Um dies zu ändern, kann ${G}installiere_neo${B} ein weiteres Mal ausgeführt werden."
echo
read -n1 -p "Drücke eine Taste um fortzufahren oder STRG+C zum Abbrechen"
;;
1)
echo
echo "Das Standardlayout wird nich verändert."
echo -e "Zu NEO kann man jederzeit mit der Abrollbewegung ${G}asdf${B} wechseln."
echo
read -n1 -p "Drücke eine Taste um fortzufahren oder STRG+C zum Abbrechen"
;;
*)
echo
echo "Bitte wählen Sie die Optionen 1, um NEO zu testen oder 2, um NEO zur Standardbelegung zu machen"
installoption=""
;;
esac
done
echo
echo
echo " Installation von NEO mit xmodmap wird gestartet…"
echo
echo
# *** main installation process ***
# creating a directory $HOME/neo with NEO files
# linking asdf and uiae scripts to $HOME/bin
erzeuge d $HOME/neo
erzeuge f xmodmap $HOME/neo/neo_de.xmodmap
erzeuge f console $HOME/neo/neo.map
erzeuge f asdf $HOME/neo/asdf
chmod u+x $HOME/neo/asdf
erzeuge l asdf
erzeuge f uiae $HOME/neo/uiae
chmod u+x $HOME/neo/uiae
erzeuge l uiae
erzeuge f neorc $HOME/.neorc
# entry in $HOME/.profile with NEO or QWERTZ as standard keyboard layout after login
case $installoption in
2)
echo
echo "Nach dem Login wird NEO die Standardbelegung sein."
echo -e "Um dies zu ändern, kann ${G}installiere_neo${B} ein weiteres Mal ausgeführt werden."
rmfromprofile
datei profile.neo > $HOME/neo/neo.profile
cat $HOME/neo/neo.profile >> $HOME/.profile
rm $HOME/neo/neo.profile
;;
1)
echo
echo "Das Standardlayout wird nich verändert."
echo -e "Zu NEO kann man jederzeit mit der Abrollbewegung ${G}asdf${B} wechseln."
rmfromprofile
datei profile.qwertz > $HOME/neo/neo.profile
cat $HOME/neo/neo.profile >> $HOME/.profile
rm $HOME/neo/neo.profile
;;
esac
# starting NEO layout
echo
echo "Die Belegung wird nun auf NEO geändert…"
cd $HOME/neo
./asdf xmodmap
echo -e "Um zu QWERTZ zurückzukehren, genügt es, die Abrollbewegung ${G}uiae${B} einzugeben."
exit
fi
# configuration file found → delete/deinstall options
echo "Es gibt auf Ihrem System bereits eine Konfiguration für NEO."
echo
echo "Sollte NEO nur für diesen Benutzer installiert sein, haben folgende Möglichkeiten:"
echo
echo " [1] NEO zukünftig nicht mehr als Standardbelegung"
echo -e " NEO wird nicht länger direkt nach dem Login zur Verfügung stehen, wohl aber nach Eingabe von ${G}adsf${B}."
echo
echo
echo " [2] NEO vollständig vom System entfernen"
echo " Dieso Option entfernt alle zuvor angelegten Verzeichnisse, Datein und Einträge zur NEO-Belegung"
echo
echo
echo " Diese Optionen funktionieren nur dann zuverlässig, wenn NEO auch mit ${G}installiere_neo${B} installiert wurde"
echo
deinstalloption=""
while [ ! $deinstalloption ] # choose between deleting NEO as standard layout or delete NEO at all
do # if deleted as standard layout only, asdf is still working
echo
read -p "Wählen Sie eine Option [1,2]: " -e deinstalloption
case $deinstalloption in
2)
echo
echo -e "Alle zuvor von ${G}installiere_neo${B} vorgenommen Änderungen am System werden gelöscht!"
echo
read -n1 -p "Drücke eine Taste um fortzufahren oder STRG+C zum Abbrechen"
deinstall # full deinstallation
;;
1)
echo
echo "NEO wird als Standardbelegung entfernt"
echo -e "Zu NEO kann man weiterhin jederzeit mit der Abrollbewegung ${G}asdf${B} wechseln."
echo
read -n1 -p "Drücke eine Taste um fortzufahren oder STRG+C zum Abbrechen"
echo
rmfromprofile # alter the entry in $HOME/.profile; first: remove old entry
echo >> $HOME/.profile # write the new entry
echo "# NEO:" >> $HOME/.profile
echo "# asdf # mit einem # am Zeilenanfang bleibt QWERTZ das Standardlayout, sonst ist es NEO" >> $HOME/.profile
;;
*)
echo
echo "Bitte wählen Sie die Optionen 1, um NEO nicht länger als Standardbelegung zu nutzen"
echo " oder 2, um NEO vollständig zu entfernen"
deinstalloption=""
;;
esac
done
exit

View File

@ -0,0 +1,53 @@
# This file contains the configuration for the Neo scripts
# Select the neo Variant to be used when using an X Server
# Values are "xkbmap", "xmodmap", "xprog", "alternative" or "evdev"
# default is xkbmap, this variable should always be set
NEO_X_VARIANTE="xmodmap"
# When using xkbmap, you may specify which xkbmap should be used, the default
# is "de" (This is useful if you installed the symbols file under a different
# name):
#NEO_XKBMAP=de
# You can also specify the xkbmap variant to be used, the default is "neo":
#NEO_XKBVARIANT=neo
# When using a xmodmap, you may specify the full path to the xmodmap to be used.
# Default:
NEO_XMODMAP="$HOME/neo/neo_de.xmodmap"
#NEO_XMODMAP_XPROG="$HOME/neo/neo_de_x-prog.xmodmap"
#NEO_XMODMAP_ALTERNATIVE="$HOME/neo/neo_de_alternative.xmodmap"
#NEO_XMODMAP_EVDEV="$HOME/neo/neo_de_evdev.xmodmap"
# Standard keyboard layout to switch back to when executing "uiae":
#STD_XKBMAP=de
# Standard layout variant to switch back to when executing "uiae":
#STD_XKBVARIANT=nodeadkeys
# Numlock status when switching to standard keyboard layout using "uiae",
# values are "on" and "off":
#NUM_LOCK_STATUS=on
# For Neo without an X System set the path to the console keymap
NEO_CONSOLE_KEYMAP="$HOME/neo/neo" # if necessary add „.map“
# Set the standard console keymap to switch back to
#STD_CONSOLE_KEYMAP="de-latin1-nodeadkeys"
# If you installed one of these programs in a non-standard path you may,
# uncomment the variable and change the path to the executable:
#PATH_XMODMAP=/usr/bin/xmodmap
#PATH_SETXKBMAP=/usr/bin/setxkbmap
#PATH_LOADKEYS=/usr/bin/loadkeys
#PATH_SUDO=/usr/bin/sudo
#PATH_SETLEDS=/usr/bin/setleds
#PATH_NUMLOCKX=/usr/bin/numlockx
#PATH_XSET=/usr/bin/xset