#!/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
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
--- /dev/null
+! 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
--- /dev/null
+# 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"
+}
--- /dev/null
+! 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
--- /dev/null
+# 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"
+}
+++ /dev/null
-! 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
+++ /dev/null
-# 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"
-}
+++ /dev/null
-! 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
+++ /dev/null
-# 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"
-}
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
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
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.