X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/9b76c8402e08f45ac0da092469aebbf0f95c8ad7..665d1e624319516779b875d3e58196f866b16649:/Library/move.sh diff --git a/Library/move.sh b/Library/move.sh index f264dcdd..4a15ca71 100755 --- a/Library/move.sh +++ b/Library/move.sh @@ -2,6 +2,13 @@ shopt -s extglob nullglob +if [[ ${1:0:1} == - ]]; then + v=$1 + shift 1 +else + v= +fi + function df_() { free=$(df -B1 "$1") free=${free% *%*} @@ -14,18 +21,18 @@ function mv_() { src=$1 mkdir -p /var/stash - dst=$(mktemp -d /var/stash/$(basename "${dir}").XXXXXX) + dst=$(mktemp -d /var/stash/"${src##*/}".XXXXXX) if [[ -e ${src} ]]; then chmod --reference="${src}" "${dst}" chown --reference="${src}" "${dst}" - cp -aT "${src}" "${dst}" || { + cp -aT $v "${src}" "${dst}" || { rm -rf "${dst}" exit 1 } - rm -rf "${src}" + rm -rf $v "${src}" else chmod 775 "${dst}" chown root.admin "${dst}" @@ -35,10 +42,10 @@ function mv_() { } 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)