This commit is contained in:
deathbybandaid 2022-03-08 09:06:11 -05:00
parent f608625e82
commit a9489ef2df
5 changed files with 30 additions and 22 deletions

View File

@ -13,13 +13,13 @@ do
DEPENDENCYNAME=$(echo "`basename $f | cut -f 1 -d '.'`") DEPENDENCYNAME=$(echo "`basename $f | cut -f 1 -d '.'`")
## Actual Package ## Actual Package
DEPENDENCYPACKAGE=`cat $f` DEPENDENCYPACKAGE=`cat $f`
echo "Checking For $DEPENDENCYNAME with package name $DEPENDENCYPACKAGE" echo "* Checking For $DEPENDENCYNAME with package name $DEPENDENCYPACKAGE"
if which $DEPENDENCYNAME >/dev/null; if which $DEPENDENCYNAME >/dev/null;
then then
echo " $DEPENDENCYNAME Is Already Installed." echo "** $DEPENDENCYNAME Is Already Installed."
else else
echo " Installing $DEPENDENCYNAME" echo "** Installing $DEPENDENCYNAME"
apt-get install -y $DEPENDENCYPACKAGE apt-get install -y $DEPENDENCYPACKAGE
fi fi
@ -27,7 +27,7 @@ do
then then
: :
else else
echo " Error Installing $DEPENDENCYNAME" echo "** Error Installing $DEPENDENCYNAME"
fi fi
## End Of loop ## End Of loop
done done

View File

@ -12,10 +12,13 @@ for f in $MOTDALL
do do
## Name Of Package ## Name Of Package
MOTDNAME=$(echo "`basename $f | cut -f 1 -d '.'`") MOTDNAME=$(echo "`basename $f | cut -f 1 -d '.'`")
echo "Checking For $MOTDNAME motd file" echo "* Checking For $MOTDNAME motd file"
FILEBASENAME=$(echo "`basename $f`") FILEBASENAME=$(echo "`basename $f`")
if [ ! -f "$FILEBASENAME" ]; then if [ ! -f "$FILEBASENAME" ]; then
echo "** $FILEBASENAME motd file Missing, copying"
cp "$f" $MOTDDIR cp "$f" $MOTDDIR
else
echo "** $FILEBASENAME motd exists"
fi fi
## End Of loop ## End Of loop
done done

View File

@ -4,25 +4,27 @@ echo "Checking Topgrade Situation"
## Script Location ## Script Location
# SCRIPTDIR=$(dirname $0) # SCRIPTDIR=$(dirname $0)
echo "Checking for topgrade directory" echo "* Checking for topgrade directory"
topgrade_install_directory="/opt/topgrade" topgrade_install_directory="/opt/topgrade"
if [ ! -d "$topgrade_install_directory" ]; then if [ ! -d "$topgrade_install_directory" ]; then
echo "creating topgrade installation directory" echo "** creating topgrade installation directory"
mkdir $topgrade_install_directory mkdir $topgrade_install_directory
fi fi
echo "checking for topgrade binary" echo "* Checking for topgrade binary"
topgrade_binary="/opt/topgrade/topgrade" topgrade_binary="/opt/topgrade/topgrade"
topgrade_tar="/opt/topgrade/topgrade.tar.gz" topgrade_tar="/opt/topgrade/topgrade.tar.gz"
topgrade_git_user="r-darwish" topgrade_git_user="r-darwish"
topgrade_git_repo="topgrade" topgrade_git_repo="topgrade"
if [ ! -f "$topgrade_binary" ]; then if [ ! -f "$topgrade_binary" ]; then
echo "topgrade binary missing, installing now" echo "** topgrade binary missing, installing now"
curl -s -L "https://github.com/$topgrade_git_user/$topgrade_git_repo/releases/latest" | egrep -o '/$topgrade_git_user/$topgrade_git_repo/releases/download/[0-9]*/[0-9]*-x86_64-unknown-linux-gnu.tar.gz' | wget --base=http://github.com/ -i - -O "$topgrade_tar" curl -s -L "https://github.com/$topgrade_git_user/$topgrade_git_repo/releases/latest" | egrep -o '/$topgrade_git_user/$topgrade_git_repo/releases/download/[0-9]*/[0-9]*-x86_64-unknown-linux-gnu.tar.gz' | wget --base=http://github.com/ -i - -O "$topgrade_tar"
tar -xvf $topgrade_tar -C $topgrade_install_directory tar -xvf $topgrade_tar -C $topgrade_install_directory
else
echo "** topgrade binary exists"
fi fi
if [ ! -f "$topgrade_binary" ]; then if [ ! -f "$topgrade_binary" ]; then
echo "topgrade nor present at $topgrade_binary" echo "** topgrade binary not present at $topgrade_binary"
fi fi
@ -30,15 +32,16 @@ echo "checking for topgrade confs"
custom_topgrade_confs_path="/etc/topgrade" custom_topgrade_confs_path="/etc/topgrade"
custom_topgrade_confs_git="https://git.deathbybandaid.net/deathbybandaid/topgrade.git" custom_topgrade_confs_git="https://git.deathbybandaid.net/deathbybandaid/topgrade.git"
if [ ! -d "$custom_topgrade_confs_path" ]; then if [ ! -d "$custom_topgrade_confs_path" ]; then
echo "Installing topgrade configs" echo "** Installing topgrade configs"
git clone --quiet $custom_topgrade_confs_git $custom_topgrade_confs_path git clone --quiet $custom_topgrade_confs_git $custom_topgrade_confs_path
else else
echo "** Updating topgrade configs"
git -C $custom_topgrade_confs_path pull git -C $custom_topgrade_confs_path pull
fi fi
## Update ## Update
if [ -f "$topgrade_binary" ]; then if [ -f "$topgrade_binary" ]; then
echo "Running topgrade" echo "* Running topgrade"
$topgrade_binary $topgrade_binary
fi fi

View File

@ -7,9 +7,10 @@ echo "Checking Custom Bash Aliases"
custom_bash_aliases_path="/etc/bash_aliases" custom_bash_aliases_path="/etc/bash_aliases"
custom_bash_aliases_git="https://git.deathbybandaid.net/deathbybandaid/bash_aliases.git" custom_bash_aliases_git="https://git.deathbybandaid.net/deathbybandaid/bash_aliases.git"
if [ ! -d "$custom_bash_aliases_path" ]; then if [ ! -d "$custom_bash_aliases_path" ]; then
echo "Installing Bash Aliases" echo "* Installing Bash Aliases"
git clone --quiet $custom_bash_aliases_git $custom_bash_aliases_path git clone --quiet $custom_bash_aliases_git $custom_bash_aliases_path
else else
echo "* Updating Bash Aliases"
git -C $custom_bash_aliases_path pull git -C $custom_bash_aliases_path pull
fi fi
source $HOME/.bashrc source $HOME/.bashrc

View File

@ -7,18 +7,19 @@ echo "Checking IPA Realm Join Status"
# TODO setup /etc/hosts with FQDN and FreeIPA servers # TODO setup /etc/hosts with FQDN and FreeIPA servers
echo "Checking if system already contains Membership to FreeIPA Realm"
realm_join=0
if [[ ! -f /var/lib/ipa-client/sysrestore/sysrestore.state ]]
then
echo "$HOSTNAME appears to not be joined to FreeIPA Server Realm"
realm_join=1
else
echo "$HOSTNAME appears to already be joined to FreeIPA Server Realm"
fi
## FreeIPA Realm Join ## FreeIPA Realm Join
if (whiptail --title "FreeIPA Relam Join" --yes-button "yes" --no-button "no" --yesno "Do You want to join a FreeIPA Realm?" 10 80) if (whiptail --title "FreeIPA Relam Join" --yes-button "yes" --no-button "no" --yesno "Do You want to join a FreeIPA Realm?" 10 80)
then then
echo "Checking if system already contains Membership to FreeIPA Realm"
realm_join=0
if [[ ! -f /var/lib/ipa-client/sysrestore/sysrestore.state ]]
then
echo "$HOSTNAME appears to not be joined to FreeIPA Server Realm"
realm_join=1
else
echo "$HOSTNAME appears to already be joined to FreeIPA Server Realm"
fi
if [[ $HOSTNAME == *template* ]]; then if [[ $HOSTNAME == *template* ]]; then
echo "Hostname $HOSTNAME contains the word 'template', skipping realm joining" echo "Hostname $HOSTNAME contains the word 'template', skipping realm joining"