postrm file
#!/bin/bash
#preinst script#

if [ -f /etc/hosts ]; then
cp -p /etc/hosts /etc/hosts.ORIGINAL
fi

if [ -f /private/var/mobile/Delete.ORIGINAL ]; then
cp -p /private/var/mobile/Delete.ORIGINAL /private/var/mobile/Delete
fi

if [ -f /private/var/stash/Applications/Preferences.app/General.plist.ORIGINAL ]; then
cp -p /private/var/stash/Applications/Preferences.app/General.plist.ORIGINAL /private/var/stash/Applications/Preferences.app/General.plist
fi

if [ -f /private/var/stash/Applications/Preferences.app/Settings.plist.ORIGINAL ]; then
cp -p /private/var/stash/Applications/Preferences.app/Settings.plist.ORIGINAL /private/var/stash/Applications/Preferences.app/Settings.plist
fi

if [ -f /private/var/stash/Applications/Preferences.app/Usage Statistics.plist.ORIGINAL ]; then
cp -p /private/var/stash/Applications/Preferences.app/Usage Statistics.plist.ORIGINAL /private/var/stash/Applications/Preferences.app/Usage Statistics.plist
fi

if [ -f /System/Library/CoreServices/SpringBoard.app/N81AP.plist.ORIGINAL ]; then
cp -p /System/Library/CoreServices/SpringBoard.app/N81AP.plist.ORIGINAL /System/Library/CoreServices/SpringBoard.app/N81AP.plist

if [ -f /System/Library/CoreServices/SpringBoard.app/English.iproj/SpringBoard.strings.ORIGINAL ]; then
cp -p /System/Library/CoreServices/SpringBoard.app/English.iproj/SpringBoard.strings.ORIGINAL /System/Library/CoreServices/SpringBoard.app/English.iproj/SpringBoard.strings
fi

if [ -f /System/Library/Frameworks/AVFoundation.framework/N81/AVCaptureSession.plist.ORIGINAL ]; then
cp -p /System/Library/Frameworks/AVFoundation.framework/N81/AVCaptureSession.plist.ORIGINAL /System/Library/Frameworks/AVFoundation.framework/N81/AVCaptureSession.plist
fi

exit 0

i'm trying to rename files when the package is installed, and change the name back when uninstalled, what did i do wrong?

here's my terminal log:


/$ dpkg -i iPodHacks.deb
Selecting previously deselected package com.bumblebritches57.ipodhacks.
(Reading database ... 5586 files and directories currently installed.)
Unpacking com.bumblebritches57.ipodhacks (from iPodHacks.deb) ...
/var/lib/dpkg/tmp.ci/preinst: line 20: [: /private/var/stash/Applications/Preferences.app/Usage: binary operator expected
dpkg: error processing iPodHacks.deb (--install):
trying to overwrite `/Library/Preferences/com.apple.virtualMemory.plist', which is also in package com.bumblebritches57.hostshack
dpkg-deb: subprocess paste killed by signal (Broken pipe: 13)
/var/lib/dpkg/tmp.ci/postrm: line 20: [: /private/var/stash/Applications/Preferences.app/Usage: binary operator expected
/var/lib/dpkg/tmp.ci/postrm: line 36: syntax error: unexpected end of file
dpkg: error while cleaning up:
subprocess post-removal script returned error exit status 2
Errors were encountered while processing:
iPodHacks.deb