summaryrefslogtreecommitdiff
path: root/over
diff options
context:
space:
mode:
Diffstat (limited to 'over')
-rwxr-xr-xover/usr/libexec/cydia_/install.sh41
1 files changed, 32 insertions, 9 deletions
diff --git a/over/usr/libexec/cydia_/install.sh b/over/usr/libexec/cydia_/install.sh
index 5c1d85d3d..2e4418b84 100755
--- a/over/usr/libexec/cydia_/install.sh
+++ b/over/usr/libexec/cydia_/install.sh
@@ -11,6 +11,34 @@ function df_() {
echo "${free}"
}
+function mv_() {
+ src=$1
+ dst=/var/$(basename "${src}")
+
+ if [[ -e ${dst} ]]; then
+ dst=$(mktemp -d /var/cydia.XXXXXX)
+ else
+ mkdir -p "${dst}"
+ fi
+
+ if [[ -e ${src} ]]; then
+ chmod --reference="${src}" "${dst}"
+ chown --reference="${src}" "${dst}"
+
+ cp -aT "${src}" "${dst}" || {
+ rm -rf "${dst}"
+ exit 1
+ }
+
+ rm -rf "${src}"
+ else
+ chmod 775 "${dst}"
+ chown root.admin "${dst}"
+ fi
+
+ ln -s "${dst}" "${src}"
+}
+
for dir in \
/Applications \
/Library/Ringtones \
@@ -23,16 +51,11 @@ do if [[ -d ${dir} && ! -h ${dir} ]]; then
free=$(df_ /var)
if [[ $((used + 524288)) -lt ${free} ]]; then
- base=$(basename "${dir}")
-
- new=/var/${base}
- if [[ -e ${new} ]]; then
- new=$(godmode mktemp -d cydia.XXXXXX)
- fi
-
- godmode mv -T "${dir}" "${new}"
- godmode ln -s "${new}" "${dir}"
+ mv_ "${dir}"
fi
+elif [[ -h ${dir} && ! -e ${dir} ]]; then
+ rm -f "${dir}"
+ mv_ "${dir}"
fi; done
[[ $(df_ /) -gt 35651584 && $(df_ /var) -gt 35651584 ]]