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 #!/bin/sh
echo -e "Configuring directories..." echo "Configuring directories..."
DOTDIR=$(cd -- "$(dirname -- $0)" &> /dev/null && pwd) cd -- "$(dirname -- $0)"
ZDOTDIR="$HOME/.config/zsh" 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 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 \ for dir in *
mako \ do
nvim \ [ -d "$dir" ] && stow -t "$HOME" --ignore="README.md" "$dir"
scripts \ done
sway \
swaylock \
swaynag \
waybar \
zsh
sleep 0.5 sleep 0.5
echo -e "Making scripts executable..." echo "Making scripts executable..."
chmod +x $DOTDIR/scripts/.local/bin/clear-clipboard.sh chmod +x scripts/.local/bin/clear-clipboard.sh
chmod +x $DOTDIR/sway/.config/sway/autostart.sh chmod +x scripts/.local/bin/update.sh
chmod +x $DOTDIR/waybar/.config/waybar/ivpn-status.sh chmod +x scripts/.local/bin/vfio.sh
chmod +x $DOTDIR/waybar/.config/waybar/ivpn-reconnect.sh chmod +x sway/.config/sway/autostart.sh
chmod +x $DOTDIR/waybar/.config/waybar/mediaplayer.py 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 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 -c
wl-copy -pc 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 if [ $(id -u) -ne 0 ]; then
echo "This script must be run as root. Quitting..." 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 if ivpn connect -last; then
notify-send -u low "IVPN" "Successfully reconnected to IVPN server:\n$(ivpn status | sed -n 2p | xargs)" 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-` TOOLTIP=`env echo -E ${STATUS} | cut -c 3-`
CLASS=`env echo ${STATUS} | grep 'VPN' | awk '{print $3}' | tr [:upper:] [:lower:]` CLASS=`env echo ${STATUS} | grep 'VPN' | awk '{print $3}' | tr [:upper:] [:lower:]`