From 0815a8096dfa0d603ae03c2fb77e4c209a05de28 Mon Sep 17 00:00:00 2001 From: meliurwen Date: Thu, 29 Jul 2021 16:19:36 +0200 Subject: [PATCH] Updated regeniso and updated some scripts --- custom/install_kubectl.sh | 26 -------------------------- custom/install_kubectl_init.sh | 32 ++++++++++++++++++++++++++++++++ custom/install_microk8s.sh | 19 +++++++++++++++++++ regeniso-sid.sh | 2 +- 4 files changed, 52 insertions(+), 27 deletions(-) create mode 100755 custom/install_kubectl_init.sh create mode 100755 custom/install_microk8s.sh diff --git a/custom/install_kubectl.sh b/custom/install_kubectl.sh index a9e741b..63322aa 100755 --- a/custom/install_kubectl.sh +++ b/custom/install_kubectl.sh @@ -49,29 +49,3 @@ systemctl restart kubelet # I guess these are the base images of kubernetes (?) echo "Pulling some base images.." kubeadm config images pull - -echo "Initializing kubernetes.." -kubeadm init - -# This if statement evaulates if the script is launched using sudo AND not -# a `sudo su` logged user -if [ -n "$SUDO_USER" ] && [ "$SUDO_COMMAND" != "/usr/bin/su" ]; then - SUDO_HOME=$(su -c "echo \$HOME" "$SUDO_USER") - echo "Adding kubernetes config to this user home folder (useful for non-root users)..." - su -c "mkdir -p $SUDO_HOME/.kube" "$SUDO_USER" - cp -i /etc/kubernetes/admin.conf "$SUDO_HOME/.kube/config" - chown "$SUDO_UID":"$SUDO_GID" "$SUDO_HOME/.kube/config" - # This last one thanks to: - # https://stackoverflow.com/questions/53814150/how-to-setup-a-2-node-kubernetes-cluster-in-custom-environment - - su -c "echo \"export KUBECONFIG=/etc/kubernetes/admin.conf\" | tee -a $SUDO_HOME/.bashrc" "$SUDO_USER" -else - echo "Adding kubernetes config to this user home folder (useful for non-root users)..." - mkdir -p "$HOME/.kube" - cp -i /etc/kubernetes/admin.conf "$HOME/.kube/config" - chown "$(id -u)":"$(id -g)" "$HOME/.kube/config" - # This last one thanks to: - # https://stackoverflow.com/questions/53814150/how-to-setup-a-2-node-kubernetes-cluster-in-custom-environment - - echo "export KUBECONFIG=/etc/kubernetes/admin.conf" | tee -a ~/.bashrc -fi diff --git a/custom/install_kubectl_init.sh b/custom/install_kubectl_init.sh new file mode 100755 index 0000000..f770d99 --- /dev/null +++ b/custom/install_kubectl_init.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +if [ "$(id -u)" -ne 0 ]; then + echo "This script should be run as root. Aborting..." > /dev/stderr + exit 1 +fi + +echo "Initializing kubernetes.." +kubeadm init + +# This if statement evaulates if the script is launched using sudo AND not +# a `sudo su` logged user +if [ -n "$SUDO_USER" ] && [ "$SUDO_COMMAND" != "/usr/bin/su" ]; then + SUDO_HOME=$(su -c "echo \$HOME" "$SUDO_USER") + echo "Adding kubernetes config to this user home folder (useful for non-root users)..." + su -c "mkdir -p $SUDO_HOME/.kube" "$SUDO_USER" + cp -i /etc/kubernetes/admin.conf "$SUDO_HOME/.kube/config" + chown "$SUDO_UID":"$SUDO_GID" "$SUDO_HOME/.kube/config" + # This last one thanks to: + # https://stackoverflow.com/questions/53814150/how-to-setup-a-2-node-kubernetes-cluster-in-custom-environment + + su -c "echo \"export KUBECONFIG=$SUDO_HOME/.kube/config\" | tee -a $SUDO_HOME/.profile" "$SUDO_USER" +else + echo "Adding kubernetes config to this user home folder (useful for non-root users)..." + mkdir -p "$HOME/.kube" + cp -i /etc/kubernetes/admin.conf "$HOME/.kube/config" + chown "$(id -u)":"$(id -g)" "$HOME/.kube/config" + # This last one thanks to: + # https://stackoverflow.com/questions/53814150/how-to-setup-a-2-node-kubernetes-cluster-in-custom-environment + + echo "export KUBECONFIG=$HOME/.kube/config" | tee -a ~/.profile +fi diff --git a/custom/install_microk8s.sh b/custom/install_microk8s.sh new file mode 100755 index 0000000..6f56235 --- /dev/null +++ b/custom/install_microk8s.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ "$(id -u)" -ne 0 ]; then + echo "This script should be run as root. Aborting..." > /dev/stderr + exit 1 +fi + +echo "Updating apt package index..." +apt-get update > /dev/null + +echo "Installing snapd..." +apt-get -q -y -o Dpkg::Use-Pty=0 install \ + snapd + +echo "Installing core..." +snap install core + +echo "Installing microk8s..." +snap install microk8s --classic diff --git a/regeniso-sid.sh b/regeniso-sid.sh index c2278ef..79af915 100755 --- a/regeniso-sid.sh +++ b/regeniso-sid.sh @@ -97,7 +97,7 @@ if [ "$IMAGE" == "netinst-mini" ]; then IMG_URL="${MIRROR}/debian/dists/${DIST}/main/installer-${ARCH}/current/images/netboot/mini.iso" else if [ "$IMAGE" == "netinst" ]; then - IMG_URL="${MIRROR}/debian-cd/current/${ARCH}/iso-cd/debian-10.6.0-${ARCH}-${IMAGE}.iso" + IMG_URL="${MIRROR}/debian-cd/current/${ARCH}/iso-cd/debian-10.10.0-${ARCH}-${IMAGE}.iso" else echo "An error occurred in selecting the proper image. Aborting..." exit 1