mirror of
https://github.com/G2-Games/welcome.sh.git
synced 2025-05-10 06:42:52 -05:00
Compare commits
No commits in common. "main" and "v1.1.2" have entirely different histories.
4 changed files with 20 additions and 54 deletions
|
@ -22,7 +22,7 @@ My goal with this script is to keep it simple, just a single line that gives use
|
|||
<hr>
|
||||
|
||||
### Installing:
|
||||
#### Automatic Installation via Curl
|
||||
#### Via Curl
|
||||
<sub>Bash:</sub>
|
||||
```
|
||||
bash -c "$(curl -s https://raw.githubusercontent.com/G2-Games/welcome.sh/main/install.sh)"
|
||||
|
@ -35,7 +35,7 @@ zsh -c "$(curl -s https://raw.githubusercontent.com/G2-Games/welcome.sh/main/ins
|
|||
It installs to `~/.welcome/welcome.sh`, and adds a line to the bottom of `~/.bashrc` or `~/.zshrc`
|
||||
|
||||
#### Manual Installation
|
||||
To install it manually, download the latest `welcome.sh` from <a href="https://github.com/G2-Games/welcome.sh/releases/latest">releases</a> and place it in your home directory. Then add `bash ~/welcome.sh` to your `.bashrc`. It works without the config file, but you can also add that to your home directory for easier manual updates.
|
||||
To use it, download the latest `welcome.sh` from <a href="https://github.com/G2-Games/welcome.sh/releases/latest">releases</a> and place it in your home directory. Then add `bash ~/welcome.sh` to your `.bashrc`. It works without the config file, but you can also add that to your home directory for easier manual updates.
|
||||
|
||||
### Updating:
|
||||
Run the script again to check for an update. If you have an older version it will prompt you. You can update **from** any version **to** any newer version. The proper files will be downloaded as necessary.
|
||||
|
|
25
cleanup.sh
25
cleanup.sh
|
@ -1,25 +0,0 @@
|
|||
#!/bin/bash
|
||||
version=1
|
||||
|
||||
echo "Ensuring welcome.sh is installed in the new location..."
|
||||
|
||||
# Check if welcome.sh is installed in the old location
|
||||
if [[ -f ~/.welcome ]]\
|
||||
|| [[ -f ~/.welcome/welcome.sh ]]\
|
||||
|| [[ -f ~/.welcome/config.cfg ]];
|
||||
then
|
||||
# Modify the files with proper paths
|
||||
sed "${i}d" "$zshrc" > file.tmp && mv file.tmp "$zshrc"
|
||||
|
||||
# Create the directories in the proper spots
|
||||
mkdir -p ~/.config/welcome.sh/
|
||||
mkdir -p ~/.local/bin/
|
||||
|
||||
# Move the welcome files to the proper folders
|
||||
mv ~/.welcome/config.cfg ~/.config/welcome.sh/config.cfg
|
||||
mv ~/.welcome/welcome.sh ~/.local/bin/welcome.sh
|
||||
|
||||
echo "welcome.sh is now installed in the new location!"
|
||||
else
|
||||
echo "welcome.sh is already installed properly!"
|
||||
fi
|
31
install.sh
31
install.sh
|
@ -62,8 +62,8 @@ update () {
|
|||
echo "Updating..."
|
||||
tput sc
|
||||
mkdir -p ~/.welcome
|
||||
rm ~/.welcome/welcome.sh 2> /dev/null
|
||||
rm ~/.welcome/install.sh 2> /dev/null
|
||||
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
|
||||
|
@ -74,19 +74,19 @@ update () {
|
|||
fi
|
||||
|
||||
# Check for older versions and replace bashrc lines
|
||||
lines=$(grep -sn 'bash ~/.welcome/welcome.sh' "$bashrc" | sed -e 's/:.*//g' && grep -sn 'bash /home/$USER/.welcome/welcome.sh' "$bashrc" | sed -e 's/:.*//g') # Find target line number
|
||||
lines=$(printf '%s\n' "$lines" | sed '1!G;h;$!d' | sed ':a;N;$!ba;s/\n/ /g') # Format the line number properly (macos doesn't have Cut)
|
||||
for i in $lines; do
|
||||
sed "${i}d" "$bashrc" > file.tmp && mv file.tmp "$bashrc"
|
||||
done
|
||||
echo 'bash ~/.welcome/welcome.sh' >> "$bashrc"
|
||||
|
||||
lines=$(grep -sn 'zsh ~/.welcome/welcome.sh' "$zshrc" | sed -e 's/:.*//g' && grep -sn 'zsh /home/$USER/.welcome/welcome.sh' "$zshrc" | sed -e 's/:.*//g')
|
||||
lines=$(grep -sn 'bash ~/.welcome/welcome.sh' $bashrc | sed -e 's/:.*//g' && grep -sn 'bash /home/$USER/.welcome/welcome.sh' $bashrc | sed -e 's/:.*//g')
|
||||
lines=$(printf '%s\n' "$lines" | sed '1!G;h;$!d' | sed ':a;N;$!ba;s/\n/ /g')
|
||||
for i in $lines; do
|
||||
sed "${i}d" "$zshrc" > file.tmp && mv file.tmp "$zshrc"
|
||||
sed "${i}d" $bashrc > file.tmp && mv file.tmp $bashrc
|
||||
done
|
||||
echo 'zsh ~/.welcome/welcome.sh' >> "$zshrc"
|
||||
echo 'bash ~/.welcome/welcome.sh' >> $bashrc
|
||||
|
||||
lines=$(grep -sn 'zsh ~/.welcome/welcome.sh' $zshrc | sed -e 's/:.*//g' && grep -sn 'zsh /home/$USER/.welcome/welcome.sh' $zshrc | sed -e 's/:.*//g')
|
||||
lines=$(printf '%s\n' "$lines" | sed '1!G;h;$!d' | sed ':a;N;$!ba;s/\n/ /g')
|
||||
for i in $lines; do
|
||||
sed "${i}d" $zshrc > file.tmp && mv file.tmp $zshrc
|
||||
done
|
||||
echo 'zsh ~/.welcome/welcome.sh' >> $zshrc
|
||||
|
||||
tput rc el ed
|
||||
echo -e "\e[32mUpdated to v$version! \e[0m"
|
||||
|
@ -128,12 +128,9 @@ this script!\e[0m Please use \e[3mBash \e[0mor \e[3mZsh.\e[0m\n" "${environment}
|
|||
fi
|
||||
|
||||
# Check if already installed
|
||||
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
|
||||
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...====#
|
||||
|
||||
tput rc
|
||||
echo "Welcome! Installing v$version in $environment..."
|
||||
tput sc
|
||||
|
|
12
welcome.sh
12
welcome.sh
|
@ -119,12 +119,12 @@ updates () {
|
|||
|
||||
# Check for updates from different places... wonder if there's a better way
|
||||
updchk () {
|
||||
# Check for APT (Debian based)
|
||||
# Check for APT
|
||||
if command -v apt-get &> /dev/null; then
|
||||
debian=$(apt-get -s dist-upgrade -V | grep -c '=>')
|
||||
fi
|
||||
|
||||
# Check for Arch things
|
||||
# Check for different Arch things
|
||||
if command -v checkupdates &> /dev/null; then
|
||||
arch=$(checkupdates 2> /dev/null | wc -l)
|
||||
elif command -v yay &> /dev/null; then
|
||||
|
@ -144,12 +144,6 @@ updates () {
|
|||
fedora=$((fedora-1))
|
||||
fi
|
||||
|
||||
# Check for OpenSUSE things
|
||||
if command -v zypper &> /dev/null; then
|
||||
suse=$(zypper list-updates 2> /dev/null | wc -l)
|
||||
suse=$((suse-4))
|
||||
fi
|
||||
|
||||
# Check for Brew updates
|
||||
if command -v brew &> /dev/null; then
|
||||
brew=$(brew outdated 2> /dev/null | wc -l)
|
||||
|
@ -161,7 +155,7 @@ updates () {
|
|||
fi
|
||||
|
||||
# Add all update counts together
|
||||
updates=$((debian + arch + fedora + suse + flatpak + brew))
|
||||
updates=$((debian + arch + fedora + flatpak + brew))
|
||||
echo $updates >| ~/.welcome/updates
|
||||
pkill -P "${pid}" sleep # When update checking is finished, kill the sleep function running under this bash process
|
||||
sleep 5
|
||||
|
|
Loading…
Reference in a new issue