diff options
author | Jay Freeman <saurik@saurik.com> | 2008-02-29 20:53:29 +0000 |
---|---|---|
committer | Jay Freeman <saurik@saurik.com> | 2008-02-29 20:53:29 +0000 |
commit | 5c98bb05c6427af989e78a82486f26423e4a631d (patch) | |
tree | c6ceb8e5810eb623d93a9d4e3440056f5f3b6d67 /over | |
parent | 809cf83be2c4ef4395617053d5d0b821442da722 (diff) |
Toughened up the bootstrap to deal with a few more border cases found in the wild.
git-svn-id: http://svn.telesphoreo.org/trunk@129 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'over')
-rwxr-xr-x | over/usr/libexec/cydia_/install.sh | 41 |
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 ]] |