Skip to content

Instantly share code, notes, and snippets.

@zudsniper
Last active February 2, 2023 05:26
Show Gist options
  • Save zudsniper/6d5207c846e4eac980bbf6072cc1be7c to your computer and use it in GitHub Desktop.
Save zudsniper/6d5207c846e4eac980bbf6072cc1be7c to your computer and use it in GitHub Desktop.
my Linode StackScript for installing barebones utilities (spooky_deb2 on Linode)
#!/bin/bash
# by zudsniper@github
# ANSI COLOR ENVIRONMENT VARS
export A_RESTORE='\033[0m'
export A_RESET='\033[0m'
export A_BOLD='\033[1m'
export A_UNDERLINE='\033[4m'
export A_INVERSE='\033[7m'
export A_ITALIC='\033[3m' #not always supported...
export A_RED='\033[00;31m'
export A_GREEN='\033[00;32m'
export A_YELLOW='\033[00;33m'
export A_BLUE='\033[00;34m'
export A_PURPLE='\033[00;35m'
export A_CYAN='\033[00;36m'
export A_LIGHTGRAY='\033[00;37m'
export A_LRED='\033[01;31m'
export A_LGREEN='\033[01;32m'
export A_LYELLOW='\033[01;33m'
export A_LBLUE='\033[01;34m'
export A_LPURPLE='\033[01;35m'
export A_LCYAN='\033[01;36m'
export A_WHITE='\033[01;37m'
# end ANSI COLOR CODES
# begin
function start () {
echo -ne "${A_GREEN}${A_BOLD}Installing spooky.tf x zod.tf debian 11 general stackscript!${A_RESET}\n";
echo -ne "${A_RED}${A_BOLD}YOU MUST BE ROOT TO EXECUTE THIS SCRIPT WITHOUT ERROR!${A_RESET}\n\n";
#sudo -i;
#npm run preInstall-labels && pm2 save;
#npm run installAptPkgs && pm2 save;
#preInstall-labels
installAptPkgs
preInstall-labels
# sp="/-\|";
# echo -n ' ';
# for i in 1; do # left as a silly loop in case we expand
# (
#
# ) &
# done
# echo -ne "${A_YELLOW}${A_BOLD}INSTALLING PTERODACTYL...${A_RESET}\n";
# bash <(curl -s https://pterodactyl-installer.se)
}
function installAptPkgs () {
#export appts=0;
#sudo su root; # be root
# add LATEST gh keys (02/01/2023)
wget -qO - https://raw.githubusercontent.com/yarnpkg/releases/gh-pages/debian/pubkey.gpg | sudo apt-key add -;
# add non-free, contrib to apt repository!
sudo apt install -y software-properties-common;
sudo apt-add-repository contrib;
sudo apt-add-repository non-free;
sudo apt update;
sudo apt install -y vim;
sudo apt install -y neovim;
sudo apt install -y nginx;
# sudo apt intall -y shadowsocks;
# sudo apt install -y openSSL;
sudo apt install -y certbot;
sudo apt install -y letsencrypt;
sudo apt install -y net-tools;
sudo apt install -y ufw;
systemctl ufw enable
ufw allow 22
ufw allow 24
ufw allow 80
ufw allow 443
#ufw allow 27015-27099
# configure firewall via pterodactyl installer?
# sudo apt install -y cpanel;
sudo apt install -y curl;
# install nvm for nodejs
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash;
source ~/.profile;
nvm install 19.3.0;
nvm use 19.3.0;
# install yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
npm i typescript -g;
npm install dotenv -g;
npm install dotenv-cli -g;
#sudo apt install postgresql -g;
# apt install gh;
apt install -y git;
# check if gh signed in
STATUS="cmd $(gh auth status 2>&1)";
echo -ne "STATUS: ${STATUS}\n\n\n";
# shellcheck disable=SC2002
if [[ $(echo -ne ${STATUS} | grep 'Logged in') -ne 1 ]]; then
echo -ne "${A_RED}${A_BOLD}gh cli is not logged in. Run ${A_RESET}${A_INVERSE}gh auth login${A_RESET}${A_RED}${A_BOLD} and try again. ${A_RESET}\n";
exit 1;
else
echo -ne "${A_BLUE}${A_UNDERLINE}Time to log in to your GitHub honey${A_RESET}\n";
sudo gh login auth;
fi
## next step time, return number of total 1st level installs
#export INSTALLATIONS_PERFORMED="${appts}";
return;
}
#this function will print a pretty summary spring to stdin,
function preInstall-labels () {
# expose environment variables if they can be set
export NGINX_PATH=$("${process.env.NGINX_PATH}" || /usr/sbin/nginx);
# build / install begins
echo -ne "${A_LCYAN}${A_BOLD}build stf-deb-base.${A_RESET}\n";
echo -ne "${A_INVERSE}Operating System${A_RESET}: Debian 11\n";
echo -ne "${A_BOLD}NETWORK${A_RESET}: \n";
echo -ne " NGiNX@latest\n"
#echo -ne " shadowsocks@latest\n";
#echo -ne " openSSL@latest\n";
echo -ne " certbot@latest\n";
echo -ne " letsencrypt@latest\n";
echo -ne " openSSH@latest\n";
echo -ne " sshd@latest\n";
echo -ne " net-tools@latest\n";
#echo -ne " cpanel@latest\n";
echo -ne "\n"
echo -ne " ${A_RED}${A_BOLD}fail2ban@latest${A_RESET} INSTALLED. ${A_RED}${A_BOLD}Warning.${A_RESET}\n\n";
echo -ne "${A_BOLD}GENERAL${A_RESET}: \n";
echo -ne " ${A_PURPLE}${A_INVERSE}nvm${A_RESET} => npm ${A_BOLD}$(npm -v)${A_RESET}, ${A_BOLD}node${A_RESET} $(node -v)\n";
echo -ne " NodeJS@latest\n";
echo -ne " TypeScript@latest\n";
echo -ne " dotenv@latest, dotenv-cli@latest\n\n";
echo -ne " \n";
#echo -ne "${A_BOLD}DATABASE${A_RESET} \n";
#echo -ne " PostgreSQL@latest\n\n";
echo -ne "${A_BOLD}DEPLOYMENT${A_RESET} \n";
echo -ne " gh_cli@latest\n";
echo -ne " git@latest\n\n";
#echo -ne "${A_BOLD}ADMIN GAMES PANEL${A_RESET} \n";
#echo -ne " pterodactyl@latest\n";
#echo -ne " pterodactyl_wings@latest\n\n";
}
updateMyself () {
me=`basename "$0"`;
export dirr=$(pwd);
cd "$(dirname "$0")";
gh gist edit https://gist.github.com/zudsniper/6d5207c846e4eac980bbf6072cc1be7c -f "${me}" StackScript.sh;
echo -ne "${A_LGREEN}${A_INVERSE}${A_BOLD}Updated live gist!${A_RESET}\n\n";
cd "${dirr}";
}
if [[ $# -eq 0 ]]; then
start
elif [[ $1 -eq gpush ]]; then
updateMyself
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment