X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/8994cfca0d90eebc43637ec7e1b6c280cc4a9aa2..3a6f9c89e5edc675d5741eb5aa66e30e798fb3aa:/Library/move.sh diff --git a/Library/move.sh b/Library/move.sh index c0fc10cd..1e9dbb22 100755 --- a/Library/move.sh +++ b/Library/move.sh @@ -20,15 +20,27 @@ function df_() { function mv_() { src=$1 - mkdir -p /var/stash + 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 } + echo -n "${src}" >"${tmp}.lnk" + if [[ -e ${src} ]]; then chmod --reference="${src}" "${dst}" chown --reference="${src}" "${dst}" @@ -38,14 +50,14 @@ function mv_() { exit 1 } - rm -rf $v "${src}" + mv $v "${src}" "${src}.moved" + ln -s "${dst}" "${src}" + rm -rf $v "${src}.moved" else chmod 775 "${dst}" chown root.admin "${dst}" + ln -s "${dst}" "${src}" fi - - ln -s "${dst}" "${src}" - echo -n "${src}" >"${tmp}.lnk" } function shift_() {