Compare commits

...

6 commits

2 changed files with 15 additions and 8 deletions

View file

@ -35,6 +35,7 @@ uninstall () {
echo "Goodbye. Uninstalling..."
tput sc
rm ~/.welcome/welcome.sh 2> /dev/null
rm ~/.welcome/install.sh 2> /dev/null
rm ~/.welcome/config.cfg 2> /dev/null
rm ~/.welcome/config_old.cfg 2> /dev/null
rm -r ~/.welcome
@ -57,13 +58,18 @@ uninstall () {
}
update () {
# To monitor number of downloads/updates
curl https://g2games.dev/Assets/counter/counter.php
tput rc el ed
echo "Updating..."
tput sc
mkdir -p ~/.welcome
rm ~/.welcome/welcome.sh
rm ~/.welcome/install.sh
curl -SL https://github.com/G2-Games/welcome.sh/releases/download/v"${version}"/welcome.sh --output ~/.welcome/welcome.sh
curl -SL https://raw.githubusercontent.com/G2-Games/welcome.sh/main/install.sh --output ~/.welcome/install.sh
if [[ $vernum -ge 100 ]] && [[ $overcfg -gt 0 ]]; then
echo "Backing up: config.cfg >> config_old.cfg"
mv ~/.welcome/config.cfg ~/.welcome/config_old.cfg
@ -128,6 +134,9 @@ fi
if ! grep -qs 'bash ~/.welcome/welcome.sh' $bashrc && ! grep -qs 'zsh ~/.welcome/welcome.sh' $zshrc && ! grep -qs 'bash /home/$USER/.welcome/welcome.sh' $bashrc && ! grep -qs 'zsh /home/$USER/.welcome/welcome.sh' $zshrc; then
#==== Execute if first time installing...====#
# To monitor number of downloads/updates
curl https://g2games.dev/Assets/counter/counter.php
tput rc
echo "Welcome! Installing v$version in $environment..."
tput sc
@ -135,6 +144,8 @@ if ! grep -qs 'bash ~/.welcome/welcome.sh' $bashrc && ! grep -qs 'zsh ~/.welcome
cd ~/ || exit 1
mkdir -p ~/.welcome
curl -SL https://github.com/G2-Games/welcome.sh/releases/download/v"${version}"/welcome.sh --output ~/.welcome/welcome.sh
curl -SL https://raw.githubusercontent.com/G2-Games/welcome.sh/main/install.sh --output ~/.welcome/install.sh
if [[ $vernum -ge 100 ]]; then
curl -SL https://github.com/G2-Games/welcome.sh/releases/download/v"${version}"/config.cfg --output ~/.welcome/config.cfg
fi

View file

@ -1,12 +1,8 @@
# Bash "strict mode" => http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'
export LC_NUMERIC="en_US.UTF-8" &> /dev/null #Fix for locales that use , instead of . as a decimal delimiter
# Define "global" variables
environment=$(ps -o args= -p $$ | grep -Em 1 -o '\w{0,5}sh' | head -1)
version=1.1.0
version=1.1.2
#========Welcome=======#
welcome () {
@ -23,7 +19,7 @@ welcome () {
fi
if [ "$randgreeting" = "on" ]; then
msg=${greetings[$greetingsNumber]}
msg=${greetings[@]:$greetingsNumber:1}
fi
# Print the welcome message
@ -270,9 +266,9 @@ lastdate=$(cat ~/.welcome/udm 2>/dev/null)
if [[ $((date - lastdate)) -ge 86400 ]]; then
if [[ "$environment" = "bash" ]]; then
bash install.sh auto
bash ~/.welcome/install.sh auto
elif [[ "$environment" = "zsh" ]]; then
zsh install.sh auto
zsh ~/.welcome/install.sh auto
fi
date +%s >| ~/.welcome/udm 2>/dev/null
elif ! [[ -f ~/.welcome/udm ]]; then