Initial commit
This commit is contained in:
commit
209ba130c0
4852 changed files with 1517959 additions and 0 deletions
14
.config/ml4w/version/compare.sh
Executable file
14
.config/ml4w/version/compare.sh
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
# ------------------------------------------------------
|
||||
# Compare installed version with used version
|
||||
# ------------------------------------------------------
|
||||
|
||||
source ~/.config/ml4w/version/library.sh
|
||||
|
||||
if [ -f /usr/share/ml4w-hyprland/dotfiles/.config/ml4w/version/name ]; then
|
||||
installed_version=$(cat /usr/share/ml4w-hyprland/dotfiles/.config/ml4w/version/name)
|
||||
used_version=$(cat ~/.config/ml4w/version/name)
|
||||
if [[ $(testvercomp $used_version $installed_version "<") == "0" ]]; then
|
||||
notify-send "Please run ml4w-hyprland-setup" "Installed version is newer then the version you're currently using."
|
||||
fi
|
||||
fi
|
||||
36
.config/ml4w/version/library.sh
Normal file
36
.config/ml4w/version/library.sh
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
vercomp() {
|
||||
if [[ $1 == $2 ]]; then
|
||||
return 0
|
||||
fi
|
||||
local IFS=.
|
||||
local i ver1=($1) ver2=($2)
|
||||
# fill empty fields in ver1 with zeros
|
||||
for ((i = ${#ver1[@]}; i < ${#ver2[@]}; i++)); do
|
||||
ver1[i]=0
|
||||
done
|
||||
for ((i = 0; i < ${#ver1[@]}; i++)); do
|
||||
if ((10#${ver1[i]:=0} > 10#${ver2[i]:=0})); then
|
||||
return 1
|
||||
fi
|
||||
if ((10#${ver1[i]} < 10#${ver2[i]})); then
|
||||
return 2
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
testvercomp() {
|
||||
vercomp $1 $2
|
||||
case $? in
|
||||
0) op='=' ;;
|
||||
1) op='>' ;;
|
||||
2) op='<' ;;
|
||||
esac
|
||||
if [[ $op != $3 ]]; then
|
||||
# No update available
|
||||
echo "1"
|
||||
else
|
||||
# Update available
|
||||
echo "0"
|
||||
fi
|
||||
}
|
||||
1
.config/ml4w/version/name
Normal file
1
.config/ml4w/version/name
Normal file
|
|
@ -0,0 +1 @@
|
|||
2.9.8.6
|
||||
25
.config/ml4w/version/update.sh
Executable file
25
.config/ml4w/version/update.sh
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
# ------------------------------------------------------
|
||||
# Check for updates
|
||||
# ------------------------------------------------------
|
||||
|
||||
source ~/.config/ml4w/version/library.sh
|
||||
|
||||
# Get latest tag from GitHub
|
||||
get_latest_release() {
|
||||
v_online=$(curl --silent "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=ml4w-hyprland")
|
||||
v_full_online=$(grep -m 1 'pkgver' <<<$v_online | sed 's/^$/pkgver/')
|
||||
echo ${v_full_online/pkgver=/}
|
||||
}
|
||||
|
||||
# Check for internet connection
|
||||
if ping -q -c 1 -W 1 google.com >/dev/null; then
|
||||
|
||||
version=$(cat ~/.config/ml4w/version/name)
|
||||
online=$(get_latest_release "mylinuxforwork/hyprland-dotfiles")
|
||||
echo $version "<" $online
|
||||
testvercomp $version $online "<"
|
||||
else
|
||||
# Network is down
|
||||
echo "1"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue