From: Christian Heller Date: Sun, 7 Feb 2016 19:44:59 +0000 (+0100) Subject: Refactor and differentiate between test and production server. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/decks/templates?a=commitdiff_plain;h=67e783c56b750fdb3d9e77eada3cd3dd9935d5f7;p=config Refactor and differentiate between test and production server. --- diff --git a/bin/symlink.sh b/bin/symlink.sh index a4c699d..5f4fc81 100755 --- a/bin/symlink.sh +++ b/bin/symlink.sh @@ -1,13 +1,13 @@ #!/bin/sh set -x +set -e dir_minimal=~/config/dotfiles/minimal -dir_user_minimal=~/config/dotfiles/user/minimal -dir_user_thinkpad=~/config/dotfiles/user/thinkpad -dir_user_X200s=~/config/dotfiles/user/x200s -dir_user_T450s=~/config/dotfiles/user/t450s -dir_user_server=~/config/dotfiles/user/server +dir_user_prefix=~/config/dotfiles/user +dir_user_minimal=$dir_user_prefix/minimal +dir_user_machine=$dir_user_prefix/$1 +dir_user_variety=$dir_user_prefix/$2 dir_root=~/config/dotfiles/root homedir=`echo ~` find ~ -lname $homedir'/config/*' -delete @@ -22,22 +22,10 @@ else for file in `ls $dir_user_minimal`; do ln -fs $dir_user_minimal/$file ~/.$file done - if [ "$1" = "thinkpad" ]; then - for file in `ls $dir_user_thinkpad`; do - ln -fs $dir_user_thinkpad/$file ~/.$file - done - if [ "$2" = "X200s" ]; then - for file in `ls $dir_user_X200s`; do - ln -fs $dir_user_X200s/$file ~/.$file - done - else - for file in `ls $dir_user_T450s`; do - ln -fs $dir_user_T450s/$file ~/.$file - done - fi - elif [ "$1" = "server" ]; then - for file in `ls $dir_user_server`; do - ln -fs $dir_user_server/$file ~/.$file - done - fi + for file in `ls $dir_user_machine`; do + ln -fs $dir_user_machine/$file ~/.$file + done + for file in `ls $dir_user_variety`; do + ln -fs $dir_user_variety/$file ~/.$file + done fi diff --git a/dotfiles/user/T450s/Xresources-local b/dotfiles/user/T450s/Xresources-local new file mode 100644 index 0000000..e44a769 --- /dev/null +++ b/dotfiles/user/T450s/Xresources-local @@ -0,0 +1,40 @@ +! font size +XTerm*faceSize: 10 +xterm*VT100*faceSize1: 7 +xterm*VT100*faceSize2: 8 +xterm*VT100*faceSize3: 9 +xterm*VT100*faceSize4: 10 +xterm*VT100*faceSize5: 12 +xterm*VT100*faceSize6: 15 + +! black +*color0: #202020 +*color8: #3F3F3F + +! red +*color1: #A82020 +*color9: #E82020 + +! green +*color2: #20A820 +*color10: #20E820 + +! yellow +*color3: #A8A820 +*color11: #E8E820 + +! blue +*color4: #3F3FFF +*color12: #9F9FFF + +! magenta +*color5: #A83FFF +*color13: #E89FFF + +! cyan +*color6: #3FA8FF +*color14: #9FE8FF + +! white +*color7: #A8A8A8 +*color15: #E8E8E8 diff --git a/dotfiles/user/T450s/i3status.conf b/dotfiles/user/T450s/i3status.conf new file mode 100644 index 0000000..8b97706 --- /dev/null +++ b/dotfiles/user/T450s/i3status.conf @@ -0,0 +1,66 @@ +# plomlompom's i3 status bar configuration + +# Activate colors; set update interval of one second. +general { + colors = true + interval = 1 +} + +# Selection / order of status elements. +order += "disk /" +order += "disk /home" +order += "wireless wlan0" +order += "ethernet eth0" +order += "battery 0" +order += "battery 1" +order += "cpu_temperature 0" +order += "load" +order += "time" + +# How much space is left in / ? +disk "/" { + format = "%free" +} + +# How much space is left in /home ? +disk "/home" { + format = "%free" +} + + +# WLAN status: show IP and connection quality or "down". +wireless wlan0 { + format_up = "W: (%quality at %essid) %ip" + format_down = "W: down" +} + +# Ethernet status: show IP or "down". +ethernet eth0 { + format_up = "E: %ip" + format_down = "E: down" +} + +# Battery status: show FULL/CHARGING/BATTERY, storage, time left. +battery 0 { + format = "%status %percentage %remaining" +} +battery 1 { + format = "%status %percentage %remaining" +} + +# Show CPU temperature in degrees of celsius. +cpu_temperature 0 { + format = "T: %degrees °C" +} + +# Show system load during last 1/5/15 minutes. +load { + format = "L: %1min %5min %15min" +} + +# Show date/time/timezone as "year-month-day hour:minute:second +# timezone_numeric/timezone_alphabetic". +time { + + format = "%Y-%m-%d %H:%M:%S %z/%Z" +} diff --git a/dotfiles/user/X200s/Xresources-local b/dotfiles/user/X200s/Xresources-local new file mode 100644 index 0000000..32c741c --- /dev/null +++ b/dotfiles/user/X200s/Xresources-local @@ -0,0 +1,34 @@ +! font size +XTerm*faceSize: 8 + +! black +*color0: #000000 +*color8: #3F3F3F + +! red +*color1: #BF0000 +*color9: #FF0000 + +! green +*color2: #00BF00 +*color10: #00FF00 + +! yellow +*color3: #BFBF00 +*color11: #FFFF00 + +! blue +*color4: #3F3FFF +*color12: #9F9FFF + +! magenta +*color5: #BF3FFF +*color13: #FFF9FF + +! cyan +*color6: #3FBFFF +*color14: #9FFFFF + +! white +*color7: #BFBFBF +*color15: #FFFFFF diff --git a/dotfiles/user/X200s/i3status.conf b/dotfiles/user/X200s/i3status.conf new file mode 100644 index 0000000..9565c9f --- /dev/null +++ b/dotfiles/user/X200s/i3status.conf @@ -0,0 +1,62 @@ +# plomlompom's i3 status bar configuration + +# Activate colors; set update interval of one second. +general { + colors = true + interval = 1 +} + +# Selection / order of status elements. +order += "disk /" +order += "disk /home" +order += "wireless wlan0" +order += "ethernet eth0" +order += "battery 0" +order += "cpu_temperature 0" +order += "load" +order += "time" + +# How much space is left in / ? +disk "/" { + format = "%free" +} + +# How much space is left in /home ? +disk "/home" { + format = "%free" +} + + +# WLAN status: show IP and connection quality or "down". +wireless wlan0 { + format_up = "W: (%quality at %essid) %ip" + format_down = "W: down" +} + +# Ethernet status: show IP or "down". +ethernet eth0 { + format_up = "E: %ip" + format_down = "E: down" +} + +# Battery status: show FULL/CHARGING/BATTERY, storage, time left. +battery 0 { + format = "%status %percentage %remaining" +} + +# Show CPU temperature in degrees of celsius. +cpu_temperature 0 { + format = "T: %degrees °C" +} + +# Show system load during last 1/5/15 minutes. +load { + format = "L: %1min %5min %15min" +} + +# Show date/time/timezone as "year-month-day hour:minute:second +# timezone_numeric/timezone_alphabetic". +time { + + format = "%Y-%m-%d %H:%M:%S %z/%Z" +} diff --git a/dotfiles/user/plomlompom.com/shinit_color b/dotfiles/user/plomlompom.com/shinit_color new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/dotfiles/user/plomlompom.com/shinit_color @@ -0,0 +1 @@ +4 diff --git a/dotfiles/user/server/shinit_color b/dotfiles/user/server/shinit_color deleted file mode 100644 index b8626c4..0000000 --- a/dotfiles/user/server/shinit_color +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/dotfiles/user/t450s/Xresources-local b/dotfiles/user/t450s/Xresources-local deleted file mode 100644 index e44a769..0000000 --- a/dotfiles/user/t450s/Xresources-local +++ /dev/null @@ -1,40 +0,0 @@ -! font size -XTerm*faceSize: 10 -xterm*VT100*faceSize1: 7 -xterm*VT100*faceSize2: 8 -xterm*VT100*faceSize3: 9 -xterm*VT100*faceSize4: 10 -xterm*VT100*faceSize5: 12 -xterm*VT100*faceSize6: 15 - -! black -*color0: #202020 -*color8: #3F3F3F - -! red -*color1: #A82020 -*color9: #E82020 - -! green -*color2: #20A820 -*color10: #20E820 - -! yellow -*color3: #A8A820 -*color11: #E8E820 - -! blue -*color4: #3F3FFF -*color12: #9F9FFF - -! magenta -*color5: #A83FFF -*color13: #E89FFF - -! cyan -*color6: #3FA8FF -*color14: #9FE8FF - -! white -*color7: #A8A8A8 -*color15: #E8E8E8 diff --git a/dotfiles/user/t450s/i3status.conf b/dotfiles/user/t450s/i3status.conf deleted file mode 100644 index 8b97706..0000000 --- a/dotfiles/user/t450s/i3status.conf +++ /dev/null @@ -1,66 +0,0 @@ -# plomlompom's i3 status bar configuration - -# Activate colors; set update interval of one second. -general { - colors = true - interval = 1 -} - -# Selection / order of status elements. -order += "disk /" -order += "disk /home" -order += "wireless wlan0" -order += "ethernet eth0" -order += "battery 0" -order += "battery 1" -order += "cpu_temperature 0" -order += "load" -order += "time" - -# How much space is left in / ? -disk "/" { - format = "%free" -} - -# How much space is left in /home ? -disk "/home" { - format = "%free" -} - - -# WLAN status: show IP and connection quality or "down". -wireless wlan0 { - format_up = "W: (%quality at %essid) %ip" - format_down = "W: down" -} - -# Ethernet status: show IP or "down". -ethernet eth0 { - format_up = "E: %ip" - format_down = "E: down" -} - -# Battery status: show FULL/CHARGING/BATTERY, storage, time left. -battery 0 { - format = "%status %percentage %remaining" -} -battery 1 { - format = "%status %percentage %remaining" -} - -# Show CPU temperature in degrees of celsius. -cpu_temperature 0 { - format = "T: %degrees °C" -} - -# Show system load during last 1/5/15 minutes. -load { - format = "L: %1min %5min %15min" -} - -# Show date/time/timezone as "year-month-day hour:minute:second -# timezone_numeric/timezone_alphabetic". -time { - - format = "%Y-%m-%d %H:%M:%S %z/%Z" -} diff --git a/dotfiles/user/test.plomlompom.com/shinit_color b/dotfiles/user/test.plomlompom.com/shinit_color new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/dotfiles/user/test.plomlompom.com/shinit_color @@ -0,0 +1 @@ +3 diff --git a/dotfiles/user/x200s/Xresources-local b/dotfiles/user/x200s/Xresources-local deleted file mode 100644 index 32c741c..0000000 --- a/dotfiles/user/x200s/Xresources-local +++ /dev/null @@ -1,34 +0,0 @@ -! font size -XTerm*faceSize: 8 - -! black -*color0: #000000 -*color8: #3F3F3F - -! red -*color1: #BF0000 -*color9: #FF0000 - -! green -*color2: #00BF00 -*color10: #00FF00 - -! yellow -*color3: #BFBF00 -*color11: #FFFF00 - -! blue -*color4: #3F3FFF -*color12: #9F9FFF - -! magenta -*color5: #BF3FFF -*color13: #FFF9FF - -! cyan -*color6: #3FBFFF -*color14: #9FFFFF - -! white -*color7: #BFBFBF -*color15: #FFFFFF diff --git a/dotfiles/user/x200s/i3status.conf b/dotfiles/user/x200s/i3status.conf deleted file mode 100644 index 9565c9f..0000000 --- a/dotfiles/user/x200s/i3status.conf +++ /dev/null @@ -1,62 +0,0 @@ -# plomlompom's i3 status bar configuration - -# Activate colors; set update interval of one second. -general { - colors = true - interval = 1 -} - -# Selection / order of status elements. -order += "disk /" -order += "disk /home" -order += "wireless wlan0" -order += "ethernet eth0" -order += "battery 0" -order += "cpu_temperature 0" -order += "load" -order += "time" - -# How much space is left in / ? -disk "/" { - format = "%free" -} - -# How much space is left in /home ? -disk "/home" { - format = "%free" -} - - -# WLAN status: show IP and connection quality or "down". -wireless wlan0 { - format_up = "W: (%quality at %essid) %ip" - format_down = "W: down" -} - -# Ethernet status: show IP or "down". -ethernet eth0 { - format_up = "E: %ip" - format_down = "E: down" -} - -# Battery status: show FULL/CHARGING/BATTERY, storage, time left. -battery 0 { - format = "%status %percentage %remaining" -} - -# Show CPU temperature in degrees of celsius. -cpu_temperature 0 { - format = "T: %degrees °C" -} - -# Show system load during last 1/5/15 minutes. -load { - format = "L: %1min %5min %15min" -} - -# Show date/time/timezone as "year-month-day hour:minute:second -# timezone_numeric/timezone_alphabetic". -time { - - format = "%Y-%m-%d %H:%M:%S %z/%Z" -} diff --git a/jessie_postinstall.sh b/jessie_postinstall.sh index 0884d13..1b2978a 100755 --- a/jessie_postinstall.sh +++ b/jessie_postinstall.sh @@ -12,6 +12,23 @@ if [ "$1" = "thinkpad" ] && [ ! "$2" = "X200s" ] && [ ! "$2" = "T450s" ]; then false fi +if [ "$1" = "server" ] && [ ! "$2" = "plomlompom.com" ] && \ + [ ! "$2" = "test.plomlompom.com" ]; then + echo "Need server type." + false +fi + +# Some important variables +if [ "$2" = "plomlompom.com" ]; then + hostname="plomlompom" +elif [ "$2" = "test.plomlompom" ]; then + hostname="test.plomlompom.com" +elif [ "$2" = "X200s" ]; then + hostname="X220s" +elif [ "$2" = "T450s" ]; then + hostname="T450s" +fi + if [ "$1" = "server" ]; then # Set root pw. passwd @@ -35,13 +52,13 @@ rm list_all_packages list_white_unsorted list_white list_black echo 'APT::Install-Recommends "false";' >> /etc/apt/apt.conf.d/99mindeps echo 'APT::Install-Suggests "false";' >> /etc/apt/apt.conf.d/99mindeps +# Set hostname and FQDN. +echo $hostname > /etc/hostname +hostname $hostname if [ "$1" = "server" ]; then - # Set hostname and FQDN. - echo 'plomlompom' > /etc/hostname - hostname 'plomlompom' echo '127.0.0.1 localhost' > /etc/hosts ip=`hostname -I` - echo "$ip plomlompom.com plomlompom" >> /etc/hosts + echo "$ip $2 $hostname" >> /etc/hosts # Call dhclient on startup. cat > /etc/systemd/system/dhclient.service << EOF @@ -55,12 +72,6 @@ ExecStart=/sbin/dhclient eth0 WantedBy=multi-user.target EOF systemctl enable /etc/systemd/system/dhclient.service -elif [ "$1" = "thinkpad" ]; then - if [ "$2" = "X200s" ]; then - echo 'X200s' > /etc/hostname - elif [ "$2" = "T450s" ]; then - echo 'T450s' > /etc/hostname - fi fi # Package management config, system upgrade.