]> git.saurik.com Git - cydia.git/blobdiff - Library/move.sh
Allow user to select a specific candidate version.
[cydia.git] / Library / move.sh
index 635c1539f68d4c0f314ea6c5880fb08ac6063ff1..54750cd43634b84c674811768745ad32c6fb350e 100755 (executable)
@@ -20,15 +20,31 @@ function df_() {
 function mv_() {
     src=$1
 
-    mkdir -p /var/stash
-    dst=$(mktemp -d /var/stash/"${src##*/}".XXXXXX)
+    if [[ ! -e /var/stash ]]; then
+        mkdir -p /var/db/stash
+        /usr/libexec/cydia/setnsfpn /var/db/stash
+        ln -s -t /var /var/db/stash
+    elif [[ -d /var/stash ]]; then
+        /usr/libexec/cydia/setnsfpn /var/stash
+    fi
+
+    tmp=$(mktemp -d /var/stash/_.XXXXXX)
+    dst=${tmp}/${src##*/}
+
+    chmod 755 "${tmp}"
+    chown root.admin "${tmp}"
+
+    mkdir -- "${dst}" || {
+        rmdir -- "${tmp}"
+        exit 1
+    }
 
     if [[ -e ${src} ]]; then
         chmod --reference="${src}" "${dst}"
         chown --reference="${src}" "${dst}"
 
         cp -aT $v "${src}" "${dst}" || {
-            rm -rf "${dst}"
+            rm -rf "${tmp}"
             exit 1
         }
 
@@ -39,13 +55,14 @@ function mv_() {
     fi
 
     ln -s "${dst}" "${src}"
+    echo -n "${src}" >"${tmp}.lnk"
 }
 
 function shift_() {
-    dir=$1
+    dir=${1%/}
 
     if [[ -d ${dir} && ! -h ${dir} ]]; then
-        used=$(du -bs "${dir}")
+        used=$(/usr/libexec/cydia/du -bs "${dir}")
         used=${used%%$'\t'*}
         free=$(df_ /var)