From 67e783c56b750fdb3d9e77eada3cd3dd9935d5f7 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sun, 7 Feb 2016 20:44:59 +0100 Subject: [PATCH] Refactor and differentiate between test and production server. --- bin/symlink.sh | 34 ++++++------------- .../user/{t450s => T450s}/Xresources-local | 0 dotfiles/user/{t450s => T450s}/i3status.conf | 0 .../user/{x200s => X200s}/Xresources-local | 0 dotfiles/user/{x200s => X200s}/i3status.conf | 0 .../{server => plomlompom.com}/shinit_color | 0 .../user/test.plomlompom.com/shinit_color | 1 + jessie_postinstall.sh | 31 +++++++++++------ 8 files changed, 33 insertions(+), 33 deletions(-) rename dotfiles/user/{t450s => T450s}/Xresources-local (100%) rename dotfiles/user/{t450s => T450s}/i3status.conf (100%) rename dotfiles/user/{x200s => X200s}/Xresources-local (100%) rename dotfiles/user/{x200s => X200s}/i3status.conf (100%) rename dotfiles/user/{server => plomlompom.com}/shinit_color (100%) create mode 100644 dotfiles/user/test.plomlompom.com/shinit_color 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 similarity index 100% rename from dotfiles/user/t450s/Xresources-local rename to dotfiles/user/T450s/Xresources-local diff --git a/dotfiles/user/t450s/i3status.conf b/dotfiles/user/T450s/i3status.conf similarity index 100% rename from dotfiles/user/t450s/i3status.conf rename to dotfiles/user/T450s/i3status.conf diff --git a/dotfiles/user/x200s/Xresources-local b/dotfiles/user/X200s/Xresources-local similarity index 100% rename from dotfiles/user/x200s/Xresources-local rename to dotfiles/user/X200s/Xresources-local diff --git a/dotfiles/user/x200s/i3status.conf b/dotfiles/user/X200s/i3status.conf similarity index 100% rename from dotfiles/user/x200s/i3status.conf rename to dotfiles/user/X200s/i3status.conf diff --git a/dotfiles/user/server/shinit_color b/dotfiles/user/plomlompom.com/shinit_color similarity index 100% rename from dotfiles/user/server/shinit_color rename to dotfiles/user/plomlompom.com/shinit_color 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/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. -- 2.30.2