Ist immernoch in der Beta-Phase.
Wenn wir es verkaufen wollen sollten wir die Beta verlassen 😉
Und hier die neuste Version:
naad.sh configures some files for arch linux.
usage: naad.sh [option] [argument]
-a About naad.sh.
-h Display this help message.
-k <ll> Set-x11-keymap <language> code
-l <ll_CC> Set <language_COUNTRY> code in locale files
-m <myhost> Set hostname
-s Show configurations
-t <timezone> Set timezone
-v <keymap> Set vconsole keymap
Examples:
./naad.sh -k fr -l fr_CA -m mon-pc -t Canada/Atlantic -v fr-latin1
./naad.sh -k de -l de_DE -m mein-pc -t Europe/Berlin -v de-latin1-nodeadkeys
Terminal commands you may need:
To search language_COUNTRY codes do 'cat /etc/locale.gen'.
To search timezone do 'find /usr/share/zoneinfo -type f | less'.
Wenn wir es verkaufen wollen sollten wir die Beta verlassen 😉
Und hier die neuste Version:
naad.sh configures some files for arch linux.
usage: naad.sh [option] [argument]
-a About naad.sh.
-h Display this help message.
-k <ll> Set-x11-keymap <language> code
-l <ll_CC> Set <language_COUNTRY> code in locale files
-m <myhost> Set hostname
-s Show configurations
-t <timezone> Set timezone
-v <keymap> Set vconsole keymap
Examples:
./naad.sh -k fr -l fr_CA -m mon-pc -t Canada/Atlantic -v fr-latin1
./naad.sh -k de -l de_DE -m mein-pc -t Europe/Berlin -v de-latin1-nodeadkeys
Terminal commands you may need:
To search language_COUNTRY codes do 'cat /etc/locale.gen'.
To search timezone do 'find /usr/share/zoneinfo -type f | less'.
#!/bin/bash
#naad.sh version 0.2 (beta) is a configuration helper for arch linux.
#
#From tuxnix with no garanty at all.
#Thanks drcux for good suggestions.
# start as root?
if [ $UID -ne 0 ]; then
sudo bash -c "$0 $*"; exit $?
fi
# exittrap
trap cleanupandexit 1 2 3 15
cleanupandexit()
{
exit 1
}
#about naad
about()
{
cat << EOF
About some configurtion related aspects with naad.sh
About naad.sh :
This script is a configurtion helper to get most common settings done. Read Arch Wiki if you need help!
Keyboard - option -k :
It's possible to choose language/layout settings with option -k. As a default model=pc105, variant=nodeadkeys and options=caps:numlock are preselectet. These values will fit to most cases. Edit the skript sektion #keyboard if you want to change this values. To search for values use the following commands: 'localectl list-x11-keymap-models |less' 'localectl list-x11-keymap-variants |less' localectl list-x11-keymap-options |less.
Locale - /etc/locale.conf - /etc/locale.gen - option l :
Both files /etc/locale.conf and /etc/locale.gen are configred with the language_COUNTRY code <ll__CC>
To aktivate LC_COLLATE=C (first all little than all big letters) collation behaviour decommend this line in '/etc/locale.conf' file afer you used the -l option.
Show your configurations - option -s :
Will display all configuration settings.
Virtual Console - /etc/vconsole.conf - option -v :
Fonts for virtual console will allways be configerd with 'FONT=lat9w-16' to search for other fonts do 'find /usr/share/kbd/consolefonts -type f | less'. Edit the vconsole.conf section in this script.
EOF
}
# help message
usage()
{
cat << EOF
naad.sh configures some files for arch linux.
usage: $0 [option] [argument]
-a About naad.sh.
-h Display this help message.
-k <ll> Set-x11-keymap <language> code
-l <ll_CC> Set <language_COUNTRY> code in locale files
-m <myhost> Set hostname
-s Show configurations
-t <timezone> Set timezone
-v <keymap> Set vconsole keymap
Examples:
./naad.sh -k fr -l fr_CA -m mon-pc -t Canada/Atlantic -v fr-latin1
./naad.sh -k de -l de_DE -m mein-pc -t Europe/Berlin -v de-latin1-nodeadkeys
Terminal commands you may need to search for arguments:
k) localectl list-x11-keymap-layouts | less
l) cat /etc/locale.gen
t) find /usr/share/zoneinfo -type f | less
v) find /usr/share/kbd/keymaps/i386/ -type f | grep <search string>
EOF
}
# show configurationes
sconf()
{
echo ""
echo "----------------------------"
echo "Display some configurations:"
echo "----------------------------"
#echo "Show - 'cat /etc/hostname':"
echo Show "'cat - /etc/hostname':"
cat /etc/hostname
echo ""
echo "Show - 'cat /etc/locale.conf':"
cat "/etc/locale.conf"
echo ""
echo "Show - 'localectl status':"
localectl status
echo ""
echo "Show - 'timedatectl status':"
timedatectl status
echo ""
echo "Show - 'cat /etc/vconsole.conf':"
cat /etc/vconsole.conf
echo ""
}
# optargs
while getopts ":ahk:l:m:st:v:" OPTION; do
case $OPTION in
a ) about; exit 1 ;;
h ) usage; exit 1 ;;
k ) layout=$OPTARG ;;
l ) ll_CC=$OPTARG ;;
m ) myhost=$OPTARG ;;
p ) privat; exit 1 ;;
s ) sconf; exit 1 ;;
t ) tizo=$OPTARG ;;
v ) vconsole=$OPTARG ;;
\? ) echo "The option -$OPTARG is not guilty." && usage >&2; exit 1 ;;
: ) echo "Option -$OPTARG requires an argument!"; exit 1 ;;
esac
done
# check options and arguments
if [[ $layout"x" == "x" ]] && [[ $ll_CC"x" == "x" ]] && [[ $myhost"x" == "x" ]] && [[ $tizo"x" == "x" ]] && [[ $vconsole"x" == "x" ]]; then
echo "Choose an option!"; cleanupandexit
fi
if ( ! localectl list-x11-keymap-layouts | grep -q "$layout" ) || [[ "$layout" == [a-z] ]]; then
echo "Nothing configured. Do 'localectl list-x11-keymap-layouts | less' to get values for -k option!"; cleanupandexit
fi
if [[ $ll_CC"x" != "x" ]];then
if ( ! grep -q "$ll_CC" "/etc/locale.gen" ) || ( [[ "$ll_CC" != [a-z][a-z]_[A-Z][A-Z] ]] && [[ "$ll_CC" != [a-z][a-z][a-z]_[A-Z][A-Z] ]] ); then
echo "Nothing configured. Do 'cat /etc/locale.gen' to get values for -l option!"; cleanupandexit
fi
fi
if ( ! find "/usr/share/zoneinfo/" -type f | grep -wq "$tizo" ); then
echo "Argument in -t is not guilty!"; echo "Find timezone, with: 'find /usr/share/zoneinfo -type f | less'"; cleanupandexit
fi
if ( ! find "/usr/share/kbd/keymaps/i386/" -type f | grep -qw "$vconsole" ); then
echo "The argument in -v is not guilty! Find keyboard map, with: 'find /usr/share/kbd/keymaps/i386/ -type f | grep' <search string>'"; cleanupandexit
fi
# keyboard
echo ""
if [[ $layout"x" != "x" ]]; then
model=pc105
variant=nodeadkeys
options=caps:numlock
echo "Set-x11-keymap..."
localectl set-x11-keymap [$layout] [$model] [$variant] [$options]
fi
if [[ $ll_CC"x" != "x" ]]; then
# set ll
ll="${ll_CC%_*}"
# edit /etc/locale.conf
#Hier muss evt. nachgebessert werden z.B. für tcy_IN.UTF-8 UTF-8
echo "Edit /etc/locale.conf..."
cat > "/etc/locale.conf" << EOF
LANG=$ll_CC.UTF-8
LANGUAGE=$ll:en
#LC_COLLATE=C
LC_TIME=$ll_CC.UTF-8
LC_PAPER=$ll_CC.UTF-8
LC_MEASUREMENT=$ll_CC.UTF-8
LC_MONETARY=$ll_CC.UTF-8
LC_NUMERIC=$ll_CC.UTF-8
LC_CTYPE=$ll_CC.UTF-8
LC_MESSAGES=$ll_CC.UTF-8
LC_NAME=$ll_CC.UTF-8
LC_ADDRESS=$ll_CC.UTF-8
LC_TELEPHONE=$ll_CC.UTF-8
LC_IDENTIFICATION=$ll_CC.UTF-8
LC_ALL=
EOF
# reconfigure /etc/locale.gen.
sed -ie "/#/!s/^/#/" "/etc/locale.gen"
# edit /etc/locale.gen
echo "Edit /etc/locale.gen..."
sed -ie "s/#$ll_CC/$ll_CC/" "/etc/locale.gen"
sed -ie "s/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" "/etc/locale.gen"
echo "locale-gen..."
echo ""
locale-gen
echo ""
fi
# edit /etc/hostname
if [[ $myhost"x" != "x" ]]; then
echo "Edit /etc/hostname..."
echo $myhost > /etc/hostname
fi
#ln /etc/localtime
if [[ $tizo"x" != "x" ]]; then
echo "Set symlink to /etc/localtime..."
ln -sf /usr/share/zoneinfo/$tizo /etc/localtime
fi
# edit /etc/vconsole.conf
if [[ $vconsole"x" != "x" ]]; then
echo "Edit /etc/vconsole.conf..."
echo KEYMAP="$vconsole" > "/etc/vconsole.conf"
echo FONT=lat9w-16 >> "/etc/vconsole.conf"
fi
echo ""
exit 0