New instalation script has begun

master
Kerem Yollu 3 years ago
parent 9c9f1f63a5
commit f667fb2f63

@ -0,0 +1,29 @@
#!/bin/bash
CONFIG_SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
os_list=(debian arch raspberry)
common_programs_list=(\
htop \
tmux \
git \
fish \
mc \
wget \
sudo \
unzip \
dmenu \
cmake \
make \
gcc \
python3 \
pulseaudio \
pulseaudio-alsa \
alsa \
alsa-utils \
exa)
os_list_count=${#os_list[@]}
main_dir=$PWD
common_programs=$( IFS=$'\n'; echo "${common_programs_list[*]}" )

@ -1,51 +1,60 @@
#!/bin/bash
common_programs_list=(\
htop \
tmux \
git \
fish \
mc \
wget \
sudo \
unzip \
dmenu \
cmake \
make \
gcc \
python3 \
pulseaudio \
pulseaudio-alsa \
alsa \
alsa-utils \
exa)
os_list=(Debian Arch Raspberry)
os_list_count=${#os_list[@]}
answer=$(($os_list_count + 1))
main_dir=$PWD
common_programs=$( IFS=$'\n'; echo "${common_programs_list[*]}" )
INSTALL_SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $INSTALL_SCRIPT_DIR/config.sh
source /home/key/git/linux/linuxSetup/new/programs/common.sh
echo "Script Location is : $INSTALL_SCRIPT_DIR"
exit_abord()
{
echo "#############################################"
echo "# Linux instalation Script Has been aborded #"
echo "#############################################"
}
exit_sucsess()
{
echo "###################################################"
echo "# Linux instalation Script Has ended with Sucsess #"
echo "###################################################"
}
echo "###########################################"
echo "# Wellcome to my Linux instalation Script #"
echo "###########################################"
echo ""
echo "-------------------------------------------"
echo "The Following programms will be installed :"
echo "-------------------------------------------"
echo "$common_programs"
echo ""
echo "---------------------"
echo "Please Select your OS"
echo "---------------------"
for i in "${!os_list[@]}";
do
echo "[$(($i + 1))] ${os_list[$i]}"
done
echo "---------------------"
echo ""
echo $answer
while (( answer > 3 ))
do
read -p "Select your os or ( $(($os_list_count + 1)) to quit ) " answer
done
read -p "Select your os or ( q to quit ) : " answer
#Checks if the goven progrramm exists.
if ! command -v foo &> /dev/null
then
echo "<the_command> could not be found"
exit
if [[ "$answer" == "q" ]]; then
exit_abord
else
if [ $answer -lt $(($os_list_count + 1)) ]; then
answer=$(( $answer - 1 ))
echo "You have selected ${os_list[$answer]}"
OS=${os_list[$answer]}
common_install_"$OS"
else
echo " the given nurber was not correct >>ABORDING<<"
exit_abord
fi
fi

@ -0,0 +1,40 @@
#!/bin/bash
COMMON_SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
common_install()
{
for i in "${!common_programs_list[@]}";
do
if ! command -v ${common_programs_list[$i]} &> /dev/null
then
echo "${common_programs_list[$i]} Will Be Installed"
echo "$1 ${common_programs_list[$i]}"
else
echo "${common_programs_list[$i]} Was found and will not be installed"
echo "$1 ${common_programs_list[$i]}"
fi
done
}
common_install_debian()
{
package_manager="sudo apt install -y "
echo "Commons are goint to be installed for $OS"
common_install "$package_manager"
}
common_install_arch()
{
package_manager="yes | sudo packman -S "
echo "Commons are goint to be installed for $OS"
common_install "$package_manager"
}
common_install_raspberry()
{
package_manager="sudo apt install -y "
echo "Commons are goint to be installed for $OS"
common_install "$package_manager"
}
Loading…
Cancel
Save