update install script
This commit is contained in:
parent
1c6e30dc83
commit
fd5cc53f7b
|
@ -10,12 +10,12 @@ SUDO="sudo"
|
||||||
check_root() {
|
check_root() {
|
||||||
# We need root rights at some point
|
# We need root rights at some point
|
||||||
if [ "$(whoami)" != "root" ]; then
|
if [ "$(whoami)" != "root" ]; then
|
||||||
if ! which $SUDO >/dev/null; then
|
if ! which $SUDO >/dev/null; then
|
||||||
echo "ERROR: $0 is not run as root and $SUDO is not available" >&2
|
echo "ERROR: $0 is not run as root and $SUDO is not available" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
SUDO="" # We're already root
|
SUDO="" # We're already root
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,17 +23,25 @@ apt_sources() {
|
||||||
# http://deb.debian.org/
|
# http://deb.debian.org/
|
||||||
ddist=$1
|
ddist=$1
|
||||||
DIST="${ddist:-stable}"
|
DIST="${ddist:-stable}"
|
||||||
if [[ ! "stable" -eq ${DIST} ]]; then
|
|
||||||
cat <<-EOF > /etc/apt/sources.list
|
allowed_dists=("testing stable stretch buster")
|
||||||
deb https://deb.debian.org/debian ${DIST} main contrib
|
if [ ! ${DIST} in "${allowed_dists[@]}" ]; then
|
||||||
deb https://deb.debian.org/debian-security ${DIST}/updates main contrib
|
echo "... $DIST was not in allowed dists... setting to stable"
|
||||||
EOF
|
DIST="stable"
|
||||||
else
|
|
||||||
cat <<-EOF > /etc/apt/sources.list
|
|
||||||
deb https://deb.debian.org/debian stable main contrib
|
|
||||||
deb https://deb.debian.org/debian-security stable-updates main contrib
|
|
||||||
EOF
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "writing /etc/apt/sources.list..."
|
||||||
|
echo "using ${DIST}"
|
||||||
|
cat <<-EOF > /etc/apt/sources.list
|
||||||
|
deb http://deb.debian.org/debian ${DIST} main
|
||||||
|
deb-src http://deb.debian.org/debian ${DIST} main
|
||||||
|
|
||||||
|
deb http://deb.debian.org/debian-security/ ${DIST}/updates main
|
||||||
|
deb-src http://deb.debian.org/debian-security/ ${DIST}/updates main
|
||||||
|
|
||||||
|
deb http://deb.debian.org/debian ${DIST}-updates main
|
||||||
|
deb-src http://deb.debian.org/debian ${DIST}-updates main
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
base_applications() {
|
base_applications() {
|
||||||
|
@ -59,8 +67,8 @@ base_applications() {
|
||||||
gcc \
|
gcc \
|
||||||
git \
|
git \
|
||||||
gnupg \
|
gnupg \
|
||||||
gnupg-agent \
|
|
||||||
gnupg \
|
gnupg \
|
||||||
|
gnupg-agent \
|
||||||
gnupg2 \
|
gnupg2 \
|
||||||
grep \
|
grep \
|
||||||
htop \
|
htop \
|
||||||
|
@ -104,13 +112,15 @@ install_server_base() {
|
||||||
apt clean
|
apt clean
|
||||||
|
|
||||||
echo "setting up logwatch..."
|
echo "setting up logwatch..."
|
||||||
|
echo "... TODO require email to be set as parameter"
|
||||||
|
echo "... TODO require email to be set as parameter"
|
||||||
cat <<-EOF > /etc/cron.daily/00logwatch
|
cat <<-EOF > /etc/cron.daily/00logwatch
|
||||||
/usr/sbin/logwatch --output mail --mailto you@example.com --detail high
|
/usr/sbin/logwatch --output mail --mailto you@example.com --detail high
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
echo " ... DONE"
|
echo " ... DONE"
|
||||||
|
|
||||||
# TODO: is this really needed?
|
# TODO: is this really needed? or default behavior anyway?
|
||||||
echo "set unattended upgrades..."
|
echo "set unattended upgrades..."
|
||||||
cat <<-EOF > /etc/apt/apt.conf.d/10periodic
|
cat <<-EOF > /etc/apt/apt.conf.d/10periodic
|
||||||
APT::Periodic::Update-Package-Lists "1";
|
APT::Periodic::Update-Package-Lists "1";
|
||||||
|
@ -123,7 +133,6 @@ EOF
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
no_suspend() {
|
no_suspend() {
|
||||||
# https://wiki.debian.org/SystemdSuspendSedation
|
# https://wiki.debian.org/SystemdSuspendSedation
|
||||||
$SUDO sed -i "s/HandleLidSwitch=.*/HandleLidSwitch=ignore/" /etc/systemd/logind.conf
|
$SUDO sed -i "s/HandleLidSwitch=.*/HandleLidSwitch=ignore/" /etc/systemd/logind.conf
|
||||||
|
@ -149,15 +158,16 @@ install_nvidia_docker() {
|
||||||
sudo apt-get install -y nvidia-docker2
|
sudo apt-get install -y nvidia-docker2
|
||||||
sudo pkill -SIGHUP dockerd
|
sudo pkill -SIGHUP dockerd
|
||||||
}
|
}
|
||||||
|
|
||||||
install_i3() {
|
install_i3() {
|
||||||
echo "update and installing i3wm and some tools..."
|
echo "update and installing i3wm and some tools..."
|
||||||
|
|
||||||
# tlp: Advanced Linux Power Management
|
# tlp: Advanced Linux Power Management
|
||||||
# http://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html
|
# http://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html
|
||||||
deb http://repo.linrunner.de/debian sid main
|
# deb http://repo.linrunner.de/debian sid main
|
||||||
|
|
||||||
# add the tlp apt-repo gpg key
|
# add the tlp apt-repo gpg key
|
||||||
apt-key adv --keyserver pool.sks-keyservers.net --recv-keys CD4E8809
|
# apt-key adv --keyserver pool.sks-keyservers.net --recv-keys CD4E8809
|
||||||
|
|
||||||
DEBIAN_FRONTEND=noninteractive
|
DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -170,10 +180,12 @@ install_i3() {
|
||||||
clipit \
|
clipit \
|
||||||
emacs \
|
emacs \
|
||||||
feh \
|
feh \
|
||||||
|
firefox-esr \
|
||||||
fonts-font-awesome \
|
fonts-font-awesome \
|
||||||
fswebcam \
|
fswebcam \
|
||||||
i3 \
|
i3 \
|
||||||
i3lock \
|
i3lock \
|
||||||
|
i3lock-fancy \
|
||||||
i3status \
|
i3status \
|
||||||
keepassxc \
|
keepassxc \
|
||||||
pulseaudio \
|
pulseaudio \
|
||||||
|
@ -404,7 +416,7 @@ main() {
|
||||||
|
|
||||||
case "$cmd" in
|
case "$cmd" in
|
||||||
base)
|
base)
|
||||||
apt_sources
|
apt_sources stable
|
||||||
base_applications
|
base_applications
|
||||||
install_docker
|
install_docker
|
||||||
install_compose
|
install_compose
|
||||||
|
@ -417,6 +429,7 @@ main() {
|
||||||
;;
|
;;
|
||||||
desktop)
|
desktop)
|
||||||
install_i3
|
install_i3
|
||||||
|
apt_sources buster
|
||||||
if [ -f "./get_private_stuff.sh" ]; then
|
if [ -f "./get_private_stuff.sh" ]; then
|
||||||
source get_private_stuff.sh
|
source get_private_stuff.sh
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue