Shell scripts:

- Improve install script with for loop
- Change hash bangs to /bin/sh because I've symlinked /bin/sh to dash, they should work with bash as well due to POSIX compliance
This commit is contained in:
the_4n0nym0u53 2022-01-08 16:24:17 +01:00
parent de9220bc73
commit b9bc23d46e
No known key found for this signature in database
GPG Key ID: 35EE09F5481049BB
6 changed files with 30 additions and 25 deletions

View File

@ -1,31 +1,28 @@
#!/bin/sh
echo -e "Configuring directories..."
DOTDIR=$(cd -- "$(dirname -- $0)" &> /dev/null && pwd)
echo "Configuring directories..."
cd -- "$(dirname -- $0)"
ZDOTDIR="$HOME/.config/zsh"
mkdir -p $ZDOTDIR # Symlink only the individual files instead of the entire directory
mkdir -p "$ZDOTDIR" # Symlink only the individual files instead of the entire directory
sleep 0.5
echo -e "Creating the symlinks with stow..."
echo "Creating the symlinks with stow..."
stow -d $DOTDIR -t $HOME --ignore="README.md" alacritty \
mako \
nvim \
scripts \
sway \
swaylock \
swaynag \
waybar \
zsh
for dir in *
do
[ -d "$dir" ] && stow -t "$HOME" --ignore="README.md" "$dir"
done
sleep 0.5
echo -e "Making scripts executable..."
echo "Making scripts executable..."
chmod +x $DOTDIR/scripts/.local/bin/clear-clipboard.sh
chmod +x $DOTDIR/sway/.config/sway/autostart.sh
chmod +x $DOTDIR/waybar/.config/waybar/ivpn-status.sh
chmod +x $DOTDIR/waybar/.config/waybar/ivpn-reconnect.sh
chmod +x $DOTDIR/waybar/.config/waybar/mediaplayer.py
chmod +x scripts/.local/bin/clear-clipboard.sh
chmod +x scripts/.local/bin/update.sh
chmod +x scripts/.local/bin/vfio.sh
chmod +x sway/.config/sway/autostart.sh
chmod +x waybar/.config/waybar/ivpn-reconnect.sh
chmod +x waybar/.config/waybar/ivpn-status.sh
chmod +x waybar/.config/waybar/mediaplayer.py
sleep 0.5
echo -e "Done!"
echo "Done!"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env dash
#!/bin/sh
wl-copy -c
wl-copy -pc

8
scripts/.local/bin/update.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
[ "$(lsb_release -si)" = "Artix" ] && paru
[ "$(lsb_release -si)" = "Fedora" ] && sudo dnf upgrade
command -v flatpak >/dev/null 2>&1 && { echo; flatpak update; }
command -v npm >/dev/null 2>&1 && { echo; npm up -g; }
command -v docker >/dev/null 2>&1 && { echo; docker images | awk '(NR>1) && ($2!~/none/) {print $1":"$2}' | xargs -l docker pull; }

View File

@ -1,4 +1,4 @@
#!/usr/bin/env dash
#!/bin/sh
if [ $(id -u) -ne 0 ]; then
echo "This script must be run as root. Quitting..."

View File

@ -1,4 +1,4 @@
#!/usr/bin/env dash
#!/bin/sh
if ivpn connect -last; then
notify-send -u low "IVPN" "Successfully reconnected to IVPN server:\n$(ivpn status | sed -n 2p | xargs)"

View File

@ -1,6 +1,6 @@
#!/usr/bin/env dash
#!/bin/sh
STATUS=`ivpn status | awk '{print "\\\n"$0}' | head -n -1`
STATUS=`ivpn status | awk '{print "\\\n"$0}'`
TOOLTIP=`env echo -E ${STATUS} | cut -c 3-`
CLASS=`env echo ${STATUS} | grep 'VPN' | awk '{print $3}' | tr [:upper:] [:lower:]`