GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
linux_lab
/
bootstrap
Browse code
Sometimes the sources.list is broken after install, so fix that.
master
1 parent
d862fbd
commit
5a232d7a7c76c57382a5e2c756ec526115153ac0
Mark George
authored
on 4 Jul 2023
Patch
Showing
1 changed file
bootstrap.sh
Ignore Space
Show notes
View
bootstrap.sh
#!/usr/bin/env bash # Author: MG BASE_PATH=$(pwd) CURRENT_USER=$(whoami) if [[ ${CURRENT_USER} != root ]]; then echo "You need to run this script as root. Aborting." exit fi cd /tmp echo "## Purging annoying crap... ##" snap remove lxd snap remove core18 apt purge cloud-init apt autopurge echo "## Disabling snapd... ##" systemctl stop snapd systemctl disable snapd echo "## Copying sources.list... ##" cp /media/infoadmin/CIDATA/sources.list /etc/apt echo "## APT Update... ##" apt update echo "## Making sure Git and Puppet are installed... ##" apt install git puppet echo "## Cloning bootstrap repo ##" git clone https://isgb.otago.ac.nz/infosci/git/linux_lab/bootstrap.git cd bootstrap echo echo -n "Enter hostname: " read hostname echo ${hostname} echo echo "About to set hostname to ${hostname} and run bootstrap." echo "Press Enter to continue or Ctrl+c to abort" read echo echo "## Setting hostname to ${hostname} ... ##" hostnamectl set-hostname ${hostname} echo echo "## Running bootstrap via puppet... ##" PUPPET_ROOT=/tmp/bootstrap/environments/production MODULE_PATH=${PUPPET_ROOT}/modules SITE_PATH=${PUPPET_ROOT}/manifests/site.pp RUBYOPT='-W0' puppet apply --modulepath ${MODULE_PATH} ${SITE_PATH} echo echo "## Cleaning up... ##" cd .. rm -rf /tmp/bootstrap echo echo "## Done. ##" exit user=$(sed -n 1p ${BASE_PATH}/domain_sekrit) domain=$(sed -n 2p ${BASE_PATH}/domain_sekrit) pass=$(sed -n 3p ${BASE_PATH}/domain_sekrit) echo echo "## Leaving domain... ##" echo ${pass} | realm leave --verbose --user=${user} ${domain} echo echo "## Joining domain... ##" echo ${pass} | realm join --verbose --user=${user} ${domain} echo #echo "## Running bootstrap via puppet again (to correct changes made as a result of domain join) ... ##" # RUBYOPT='-W0' puppet apply --modulepath ${MODULE_PATH} ${SITE_PATH} echo echo "## Cleaning up... ##" #cd .. #rm -rf /tmp/bootstrap echo echo "## Done. ##"
#!/usr/bin/env bash # Author: MG BASE_PATH=$(pwd) CURRENT_USER=$(whoami) if [[ ${CURRENT_USER} != root ]]; then echo "You need to run this script as root. Aborting." exit fi cd /tmp echo "## Purging annoying crap... ##" snap remove lxd snap remove core18 apt purge cloud-init apt autopurge echo "## Cloning bootstrap repo ##" git clone https://isgb.otago.ac.nz/infosci/git/linux_lab/bootstrap.git cd bootstrap echo echo -n "Enter hostname: " read hostname echo ${hostname} echo echo "About to set hostname to ${hostname} and run bootstrap." echo "Press Enter to continue or Ctrl+c to abort" read echo echo "## Setting hostname to ${hostname} ... ##" hostnamectl set-hostname ${hostname} echo echo "## Running bootstrap via puppet... ##" PUPPET_ROOT=/tmp/bootstrap/environments/production MODULE_PATH=${PUPPET_ROOT}/modules SITE_PATH=${PUPPET_ROOT}/manifests/site.pp RUBYOPT='-W0' puppet apply --modulepath ${MODULE_PATH} ${SITE_PATH} echo echo "## Cleaning up... ##" cd .. rm -rf /tmp/bootstrap echo echo "## Done. ##" exit user=$(sed -n 1p ${BASE_PATH}/domain_sekrit) domain=$(sed -n 2p ${BASE_PATH}/domain_sekrit) pass=$(sed -n 3p ${BASE_PATH}/domain_sekrit) echo echo "## Leaving domain... ##" echo ${pass} | realm leave --verbose --user=${user} ${domain} echo echo "## Joining domain... ##" echo ${pass} | realm join --verbose --user=${user} ${domain} echo #echo "## Running bootstrap via puppet again (to correct changes made as a result of domain join) ... ##" # RUBYOPT='-W0' puppet apply --modulepath ${MODULE_PATH} ${SITE_PATH} echo echo "## Cleaning up... ##" #cd .. #rm -rf /tmp/bootstrap echo echo "## Done. ##"
Show line notes below