mirror of
https://gitlab.com/Zaney/zaneyos.git
synced 2025-01-07 13:08:49 +01:00
Ensure wallsetter script doesn't eat up memory or cpu if wallpaper dir not setup properly
This commit is contained in:
parent
c70965ce81
commit
870b06ea32
@ -12,15 +12,16 @@ pkgs.writeShellScriptBin "wallsetter" ''
|
|||||||
if [ -d ${wallpaperDir} ]; then
|
if [ -d ${wallpaperDir} ]; then
|
||||||
num_files=$(ls -1 ${wallpaperDir} | wc -l)
|
num_files=$(ls -1 ${wallpaperDir} | wc -l)
|
||||||
|
|
||||||
if [ "$num_files" -eq 0 ]; then
|
if [ "$num_files" -lt 1 ]; then
|
||||||
notify-send "The wallpaper folder is empty. Exiting Wallsetter."
|
notify-send -t 900 "The wallpaper folder is empty. Exiting Wallsetter."
|
||||||
exit
|
|
||||||
elif [ "$num_files" -eq 1 ]; then
|
|
||||||
notify-send "The wallpaper folder has only one file. Exiting Wallsetter."
|
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
cd ${wallpaperDir}
|
cd ${wallpaperDir}
|
||||||
git pull
|
if [ -d ".git" ]; then
|
||||||
|
git pull
|
||||||
|
else
|
||||||
|
notify-send -t 900 "The wallpaper directory is expected to be a Git repository. Exiting Wallsetter."
|
||||||
|
exit
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
${pkgs.git}/bin/git clone ${wallpaperGit} ${wallpaperDir}
|
${pkgs.git}/bin/git clone ${wallpaperGit} ${wallpaperDir}
|
||||||
|
Loading…
Reference in New Issue
Block a user