]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
refine package destination
authordrjaska <drjaska83@gmail.com>
Thu, 18 May 2023 03:58:28 +0000 (06:58 +0300)
committerdrjaska <drjaska83@gmail.com>
Sun, 28 Jul 2024 08:29:36 +0000 (11:29 +0300)
qcsrc/tools/git-progs-pk3packer.sh

index b8e09b0d36c1a3b45fe827a1a781492c796603ef..fcd800ddef07028be205e338bdad8d9c44a5d1a9 100755 (executable)
 
 
 
+# The pk3 is moved to Downloads directory for
+# easy sharing and house keeping. If the user
+# has set their xdg directories' DOWNLOAD dir
+# then it'll be respected. Second option is
+# ~/Downloads directory. If neither of those
+# exists then it's left in the current working
+# directory, the root of xonotic-data.pk3dir
+
+
+
 # abort on error(non-0 return code) and abort on unset variable
 set -eu
 
@@ -111,20 +121,20 @@ fi
 zip git-progspk3.zip csprogs.dat progs.dat menu.dat progs.txt "csprogs-$HASH.dat" "progs-$HASH.dat" $EDITEDCFGS changes.diff
 
 # Move the package to Downloads directory for easy sharing and house keeping
-if [ "$(xdg-user-dir DOWNLOAD)" != "$HOME" ]
+if [ "$(xdg-user-dir DOWNLOAD)" != "$HOME" ] && [ -d "$(xdg-user-dir DOWNLOAD)" ]
 then
        mv -v "$PWD/git-progspk3.zip" "$(xdg-user-dir DOWNLOAD)/git-progs-$BRANCH-$HASH.pk3"
        printf "\n%s\n%s\n\n" "Packaged progs based on $BRANCH's $HASH commit" \
                "and moved them to $(xdg-user-dir DOWNLOAD)/git-progs-$BRANCH-$HASH.pk3"
 
-elif [ -d ~/Downloads ]
+elif [ -d "$HOME/Downloads" ]
 then
        mv -v "$PWD/git-progspk3.zip" "$HOME/Downloads/git-progs-$BRANCH-$HASH.pk3"
        printf "\n%s\n%s\n\n" "Packaged progs based on $BRANCH's $HASH commit" \
                "and moved them to ~/Downloads/git-progs-$BRANCH-$HASH.pk3"
 
 else
-       mv -v "$PWD/git-progspk3.zip" "$PWD/git-progs-$BRANCH-$HASH.pk3"
+       mv -v "git-progspk3.zip" "git-progs-$BRANCH-$HASH.pk3"
        printf "\n%s\n%s\n%s\n\n" "Packaged progs based on $BRANCH's $HASH commit" \
                "but could not move it out to Downloads dir" \
                "git-progs-$BRANCH-$HASH.pk3 resides in $PWD"