diff --git a/dependencies/curl.dep b/dependencies/curl.dep new file mode 100644 index 0000000..13368f8 --- /dev/null +++ b/dependencies/curl.dep @@ -0,0 +1 @@ +curl diff --git a/dependencies/git.dep b/dependencies/git.dep new file mode 100644 index 0000000..5664e30 --- /dev/null +++ b/dependencies/git.dep @@ -0,0 +1 @@ +git diff --git a/dependencies/ipa-client-install.dep b/dependencies/ipa-client-install.dep new file mode 100644 index 0000000..d7207f8 --- /dev/null +++ b/dependencies/ipa-client-install.dep @@ -0,0 +1 @@ +freeipa-client diff --git a/dependencies/neofetch.dep b/dependencies/neofetch.dep new file mode 100644 index 0000000..f8d43b1 --- /dev/null +++ b/dependencies/neofetch.dep @@ -0,0 +1 @@ +neofetch diff --git a/dependencies/tar.dep b/dependencies/tar.dep new file mode 100644 index 0000000..42f2fb7 --- /dev/null +++ b/dependencies/tar.dep @@ -0,0 +1 @@ +tar diff --git a/dependencies/wget.dep b/dependencies/wget.dep new file mode 100644 index 0000000..74180cc --- /dev/null +++ b/dependencies/wget.dep @@ -0,0 +1 @@ +wget diff --git a/dependencies/whiptail.dep b/dependencies/whiptail.dep new file mode 100644 index 0000000..cb6cb5c --- /dev/null +++ b/dependencies/whiptail.dep @@ -0,0 +1 @@ +whiptail diff --git a/template_setup.sh b/template_setup.sh index ba0f0c7..5ac3f65 100644 --- a/template_setup.sh +++ b/template_setup.sh @@ -3,28 +3,70 @@ echo "Setting up template environment" ## Script Location SCRIPTDIR=$(dirname $0) -echo $SCRIPTDIR -## Folder Name of Script -COMPLETEFOLDERPATH=$(realpath $SCRIPTDIR) -echo $COMPLETEFOLDERPATH +echo "Checking Dependencies" +## 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" -source $HOME/.bashrc + if which $DEPENDENCYNAME >/dev/null; + then + echo "$DEPENDENCYNAME Is Already Installed." + else + echo "Installing $DEPENDENCYNAME" + apt-get install -y $DEPENDENCYPACKAGE + fi -## Check for whiptail -if which whiptail >/dev/null; -then - : -else - apt-get install -y whiptail + if which $DEPENDENCYNAME >/dev/null; + then + : + else + echo "Error Installing $DEPENDENCYNAME" + fi +## End Of loop +done + +topgrade_install_directory="/opt/topgrade" +if [ ! -d "$topgrade_install_directory" ]; then + echo "creating topgrade installation directory" + mkdir $topgrade_install_directory fi -## Check for git -if which git >/dev/null; -then - : -else - apt-get install -y git +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 + +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 + +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 + +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