88 lines
2.2 KiB
Bash
88 lines
2.2 KiB
Bash
#!/bin/bash
|
|
|
|
function info () {
|
|
printf "\r [ \033[00;34m..\033[0m ] %s\n" "$1"
|
|
}
|
|
function user () {
|
|
printf "\r [ \033[0;33m??\033[0m ] %s " "$1"
|
|
}
|
|
function success () {
|
|
printf "\r\033[2K [ \033[00;32mOK\033[0m ] %s\n" "$1"
|
|
}
|
|
function warn () {
|
|
printf "\r\033[2K [\033[0;31mWARN\033[0m] %s\n" "$1"
|
|
}
|
|
function fail () {
|
|
printf "\r\033[2K [\033[0;31mFAIL\033[0m] %s\n" "$1"
|
|
echo ''
|
|
exit 1
|
|
}
|
|
|
|
function check_and_install_package () {
|
|
info "Checking for $1"
|
|
if dpkg -s "$1" > /dev/null 2>&1 ; then
|
|
success "$1 is already installed"
|
|
else
|
|
info "$1 not found, installing now"
|
|
if sudo apt-get install "$1" -y > /dev/null ; then
|
|
success "$1 successfully installed"
|
|
else
|
|
fail "$1 failed to install"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
function update_and_upgrade () {
|
|
# Updates & upgrades
|
|
info "Updating packages"
|
|
if sudo apt-get update -y > /dev/null ; then
|
|
success "Packages were updated"
|
|
else
|
|
fail "Packages were unable to be updated"
|
|
fi
|
|
|
|
info "Upgrading packages"
|
|
if sudo apt-get dist-upgrade -y > /dev/null ; then
|
|
success "Packages were upgraded"
|
|
else
|
|
fail "Packages were unable to be upgraded"
|
|
fi
|
|
}
|
|
|
|
function auto_remove () {
|
|
# Auto removes any unnecessary packages
|
|
info "Auto removing any unnecessary packages"
|
|
if sudo apt-get autoremove -y > /dev/null ; then
|
|
success "All unnecessary packages removed"
|
|
else
|
|
fail "Unable to remove unnecessary packages"
|
|
fi
|
|
}
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
sudo ln -fs /usr/share/zoneinfo/Indian/Reunion /etc/localtime
|
|
|
|
update_and_upgrade
|
|
check_and_install_package "git"
|
|
check_and_install_package "tzdata"
|
|
sudo dpkg-reconfigure --frontend noninteractive tzdata
|
|
|
|
sudo apt-get update
|
|
sudo apt-get install -y wget apt-transport-https software-properties-common
|
|
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
|
|
sudo dpkg -i packages-microsoft-prod.deb
|
|
rm packages-microsoft-prod.deb
|
|
sudo apt-get update
|
|
sudo add-apt-repository universe
|
|
sudo apt-get install -y powershell
|
|
chsh -s /usr/bin/pwsh
|
|
|
|
sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
|
|
sudo chmod +x /usr/local/bin/oh-my-posh
|
|
|
|
pwsh -c ./shell/setup.ps1
|
|
pwsh -c ./git/setup.ps1
|
|
pwsh -c ./ssh/setup.ps1
|
|
pwsh
|
|
|