Skip to content

Instantly share code, notes, and snippets.

@clayfreeman
Last active August 29, 2015 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save clayfreeman/630b640733558877ccf8 to your computer and use it in GitHub Desktop.
Save clayfreeman/630b640733558877ccf8 to your computer and use it in GitHub Desktop.
move.sh — Cydia patch for iOS 8
#!/bin/bash
shopt -s extglob nullglob
if [[ ${1:0:1} == - ]]; then
v=$1
shift 1
else
v=
fi
function df_() {
free=$(df -B1 "$1")
free=${free% *%*}
free=${free%%*( )}
free=${free##* }
echo "${free}"
}
function mv_() {
src=$1
mkdir -p /stash
tmp=$(mktemp -d /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}"
mv "${src}" "${dst}" || {
exit 1
}
rm -rf $v "${src}"
else
chmod 775 "${dst}"
chown root.admin "${dst}"
fi
ln -s "${dst}/${src##*/}" "${src}"
echo -n "${src}" >"${tmp}.lnk"
}
function shift_() {
dir=${1%/}
if [[ -d ${dir} && ! -h ${dir} ]]; then
used=$(/usr/libexec/cydia/du -bs "${dir}")
used=${used%%$'\t'*}
free=$(df_ /var)
if [[ $((used + 524288)) -lt ${free} ]]; then
mv_ "${dir}"
fi
elif [[ ! -e ${dir} ]]; then
rm -f "${dir}"
mv_ "${dir}"
fi
}
shift_ "$@"
@seanybiker
Copy link

how the shit do I download from here :(

@piverson
Copy link

how to I copy this so I can do as is required I am unable to copy move.sh

@cromarate
Copy link

You can download it by pressing the button on the screenshot here: http://take.ms/LRnlJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment