test
This commit is contained in:
parent
3930ac50ca
commit
838ec62d9a
33
00-dependencies.sh
Normal file
33
00-dependencies.sh
Normal file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
echo "Checking Dependencies"
|
||||
|
||||
## Script Location
|
||||
SCRIPTDIR=$(dirname $0)
|
||||
|
||||
## Start File Loop
|
||||
## For .dependency files In The dependencies Directory
|
||||
DEPENDENCIESALL="$SCRIPTDIR/dependencies/*.dep"
|
||||
for f in $DEPENDENCIESALL
|
||||
do
|
||||
## Name Of Package
|
||||
DEPENDENCYNAME=$(echo "`basename $f | cut -f 1 -d '.'`")
|
||||
## Actual Package
|
||||
DEPENDENCYPACKAGE=`cat $f`
|
||||
echo "Checking For $DEPENDENCYNAME with package name $DEPENDENCYPACKAGE"
|
||||
|
||||
if which $DEPENDENCYNAME >/dev/null;
|
||||
then
|
||||
echo "$DEPENDENCYNAME Is Already Installed."
|
||||
else
|
||||
echo "Installing $DEPENDENCYNAME"
|
||||
apt-get install -y $DEPENDENCYPACKAGE
|
||||
fi
|
||||
|
||||
if which $DEPENDENCYNAME >/dev/null;
|
||||
then
|
||||
:
|
||||
else
|
||||
echo "Error Installing $DEPENDENCYNAME"
|
||||
fi
|
||||
## End Of loop
|
||||
done
|
||||
21
01-motd.sh
Normal file
21
01-motd.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
echo "Checking For Custom MOTD"
|
||||
|
||||
## Script Location
|
||||
SCRIPTDIR=$(dirname $0)
|
||||
|
||||
## Start File Loop
|
||||
## For .dependency files In The dependencies Directory
|
||||
MOTDDIR="/etc/update-motd.d/"
|
||||
MOTDALL="$SCRIPTDIR/motd/*"
|
||||
for f in $MOTDALL
|
||||
do
|
||||
## Name Of Package
|
||||
MOTDNAME=$(echo "`basename $f | cut -f 1 -d '.'`")
|
||||
echo "Checking For $MOTDNAME motd file"
|
||||
FILEBASENAME=$(echo "`basename $f`")
|
||||
if [ ! -f "$FILEBASENAME" ]; then
|
||||
cp "$f" $MOTDDIR
|
||||
fi
|
||||
## End Of loop
|
||||
done
|
||||
44
02-topgrade.sh
Normal file
44
02-topgrade.sh
Normal file
@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
echo "Checking Topgrade Situation"
|
||||
|
||||
## Script Location
|
||||
# SCRIPTDIR=$(dirname $0)
|
||||
|
||||
echo "Checking for topgrade directory"
|
||||
topgrade_install_directory="/opt/topgrade"
|
||||
if [ ! -d "$topgrade_install_directory" ]; then
|
||||
echo "creating topgrade installation directory"
|
||||
mkdir $topgrade_install_directory
|
||||
fi
|
||||
|
||||
echo "checking for topgrade binary"
|
||||
topgrade_binary="/opt/topgrade/topgrade"
|
||||
topgrade_tar="/opt/topgrade/topgrade.tar.gz"
|
||||
topgrade_git_user="r-darwish"
|
||||
topgrade_git_repo="topgrade"
|
||||
if [ ! -f "$topgrade_binary" ]; then
|
||||
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"
|
||||
tar -xvf $topgrade_tar -C $topgrade_install_directory
|
||||
fi
|
||||
if [ ! -f "$topgrade_binary" ]; then
|
||||
echo "topgrade nor present at $topgrade_binary"
|
||||
fi
|
||||
|
||||
|
||||
echo "checking for topgrade confs"
|
||||
custom_topgrade_confs_path="/etc/topgrade"
|
||||
custom_topgrade_confs_git="https://git.deathbybandaid.net/deathbybandaid/topgrade.git"
|
||||
if [ ! -d "$custom_topgrade_confs_path" ]; then
|
||||
echo "Installing topgrade configs"
|
||||
git clone --quiet $custom_topgrade_confs_git $custom_topgrade_confs_path
|
||||
else
|
||||
git -C $custom_topgrade_confs_git pull
|
||||
fi
|
||||
|
||||
|
||||
## Update
|
||||
if [ -f "$topgrade_binary" ]; then
|
||||
echo "Running topgrade"
|
||||
$topgrade_binary
|
||||
fi
|
||||
15
03-bash_aliases.sh
Normal file
15
03-bash_aliases.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
echo "Checking Custom Bash Aliases"
|
||||
|
||||
## Script Location
|
||||
# SCRIPTDIR=$(dirname $0)
|
||||
|
||||
custom_bash_aliases_path="/etc/bash_aliases"
|
||||
custom_bash_aliases_git="https://git.deathbybandaid.net/deathbybandaid/bash_aliases.git"
|
||||
if [ ! -d "$custom_bash_aliases_path" ]; then
|
||||
echo "Installing Bash Aliases"
|
||||
git clone --quiet $custom_bash_aliases_git $custom_bash_aliases_path
|
||||
else
|
||||
git -C $custom_bash_aliases_git pull
|
||||
fi
|
||||
source $HOME/.bashrc
|
||||
36
04-freeipa_realm_join.sh
Normal file
36
04-freeipa_realm_join.sh
Normal file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
echo "Checking IPA Realm Join Status"
|
||||
|
||||
## Script Location
|
||||
# SCRIPTDIR=$(dirname $0)
|
||||
|
||||
|
||||
# TODO setup /etc/hosts with FQDN and FreeIPA servers
|
||||
|
||||
## 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)
|
||||
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
|
||||
echo "Hostname $HOSTNAME contains the word 'template', skipping realm joining"
|
||||
realm_join=0
|
||||
fi
|
||||
|
||||
if [ "$realm_join" == 1 ]; then
|
||||
echo "Setting up ipa-client to join FreeIPA Server Realm"
|
||||
freeipa_admin=$(whiptail --passwordbox "Please enter the user authorized to join FreeIPA realm: $freeipa_admin" 8 78 --title "FreeIPA Admin User Prompt" 3>&1 1>&2 2>&3)
|
||||
freeipa_password=$(whiptail --passwordbox "Please enter the password for the FreeIPA admin user: $freeipa_admin" 8 78 --title "FreeIPA Password Prompt" 3>&1 1>&2 2>&3)
|
||||
ipa-client-install --mkhomedir --no-ntp --principal="$freeipa_admin" --password="$freeipa_password" --enable-dns-updates --unattended
|
||||
fi
|
||||
else
|
||||
echo "Skipping realm joining"
|
||||
fi
|
||||
2
motd/01-neofetch
Normal file
2
motd/01-neofetch
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
/usr/bin/neofetch
|
||||
@ -3,105 +3,10 @@ echo "Setting up template environment"
|
||||
|
||||
## Script Location
|
||||
SCRIPTDIR=$(dirname $0)
|
||||
# SCRIPTREPO="https://git.deathbybandaid.net/deathbybandaid/template_setup.git"
|
||||
git -C $SCRIPTDIR pull
|
||||
|
||||
echo "Checking Dependencies"
|
||||
## Start File Loop
|
||||
## For .dependency files In The dependencies Directory
|
||||
DEPENDENCIESALL="$SCRIPTDIR/dependencies/*.dep"
|
||||
for f in $DEPENDENCIESALL
|
||||
for scriptfile in "$SCRIPTDIR"/[0-9]*.sh
|
||||
do
|
||||
## Name Of Package
|
||||
DEPENDENCYNAME=$(echo "`basename $f | cut -f 1 -d '.'`")
|
||||
## Actual Package
|
||||
DEPENDENCYPACKAGE=`cat $f`
|
||||
echo "Checking For $DEPENDENCYNAME with package name $DEPENDENCYPACKAGE"
|
||||
|
||||
if which $DEPENDENCYNAME >/dev/null;
|
||||
then
|
||||
echo "$DEPENDENCYNAME Is Already Installed."
|
||||
else
|
||||
echo "Installing $DEPENDENCYNAME"
|
||||
apt-get install -y $DEPENDENCYPACKAGE
|
||||
fi
|
||||
|
||||
if which $DEPENDENCYNAME >/dev/null;
|
||||
then
|
||||
:
|
||||
else
|
||||
echo "Error Installing $DEPENDENCYNAME"
|
||||
fi
|
||||
## End Of loop
|
||||
/bin/bash $scriptfile
|
||||
done
|
||||
|
||||
echo "checking for topgrade directory"
|
||||
topgrade_install_directory="/opt/topgrade"
|
||||
if [ ! -d "$topgrade_install_directory" ]; then
|
||||
echo "creating topgrade installation directory"
|
||||
mkdir $topgrade_install_directory
|
||||
fi
|
||||
|
||||
echo "checking for topgrade binary"
|
||||
topgrade_binary="/opt/topgrade/topgrade"
|
||||
topgrade_git_user="r-darwish"
|
||||
topgrade_git_repo="topgrade"
|
||||
if [ ! -f "$topgrade_binary" ]; then
|
||||
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_binary.tar.gz"
|
||||
fi
|
||||
|
||||
echo "checking for neofetch motd"
|
||||
neofetch_motd="/etc/update-motd.d/01-neofetch"
|
||||
if [ ! -f "$neofetch_motd" ]; then
|
||||
echo "Installing Neofetch MOTD"
|
||||
echo "#!/bin/bash" | tee --append $neofetch_motd &>/dev/null
|
||||
echo "/usr/bin/neofetch" | tee --append $neofetch_motd &>/dev/null
|
||||
fi
|
||||
|
||||
echo "checking for custom bash aliases"
|
||||
custom_bash_aliases_path="/etc/bash_aliases"
|
||||
custom_bash_aliases_git="https://git.deathbybandaid.net/deathbybandaid/bash_aliases"
|
||||
if [ ! -d "$custom_bash_aliases_path" ]; then
|
||||
echo "Installing Bash Aliases"
|
||||
git clone --quiet $custom_bash_aliases_git $custom_bash_aliases_path
|
||||
fi
|
||||
source $HOME/.bashrc
|
||||
|
||||
echo "checking for topgrade confs"
|
||||
custom_topgrade_confs_path="/etc/topgrade"
|
||||
custom_topgrade_confs_git="https://git.deathbybandaid.net/deathbybandaid/topgrade"
|
||||
if [ ! -d "$custom_topgrade_confs_path" ]; then
|
||||
echo "Installing topgrade configs"
|
||||
git clone --quiet $custom_topgrade_confs_git $custom_topgrade_confs_path
|
||||
fi
|
||||
|
||||
## Update
|
||||
echo "Running topgrade"
|
||||
/opt/topgrade/topgrade
|
||||
|
||||
## 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)
|
||||
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
|
||||
echo "Hostname $HOSTNAME contains the word 'template', skipping realm joining"
|
||||
realm_join=0
|
||||
fi
|
||||
|
||||
if [ "$realm_join" == 1 ]; then
|
||||
echo "Setting up ipa-client to join FreeIPA Server Realm"
|
||||
freeipa_admin=$(whiptail --passwordbox "Please enter the user authorized to join FreeIPA realm: $freeipa_admin" 8 78 --title "FreeIPA Admin User Prompt" 3>&1 1>&2 2>&3)
|
||||
freeipa_password=$(whiptail --passwordbox "Please enter the password for the FreeIPA admin user: $freeipa_admin" 8 78 --title "FreeIPA Password Prompt" 3>&1 1>&2 2>&3)
|
||||
ipa-client-install --mkhomedir --no-ntp --principal="$freeipa_admin" --password="$freeipa_password" --enable-dns-updates --unattended
|
||||
fi
|
||||
else
|
||||
echo "Skipping realm joining"
|
||||
fi
|
||||
|
||||
Loading…
Reference in New Issue
Block a user