Skip to content

Instantly share code, notes, and snippets.

@stasm
Created December 20, 2011 09:34
Show Gist options
  • Save stasm/1500954 to your computer and use it in GitHub Desktop.
Save stasm/1500954 to your computer and use it in GitHub Desktop.
Migrate your mobile/ directory to the new layout with mobile/android and mobile/xul
#!/bin/bash
function msg {
echo
echo "########################################"
echo -e $@
echo "########################################"
echo
}
if [[ ! -e $(pwd)/.hg ]]; then
echo "Please run the script from within the root of your repo."
exit 1
fi
if [[ -n $(hg status) ]]; then
echo "You appear to have local changes in your clone."
echo "Please commit them or make sure you're working on a clean"
echo "clone with"
echo " hg update --clean"
exit 1
fi
if [[ -e mobile/android || -e mobile/xul ]]; then
echo "Your mobile directory is not suitable for migration."
echo "Did you already try to migrate yourself?"
exit 1
fi
echo "This script will juggle the files in mobile/ in order to"
echo "match the recent changes to the directory structure related"
echo "to the native Firefox builds for Android."
echo
echo "See http://bugzil.la/708015 for details."
echo
read -n 1 -p "Do you want to continue? [y/N] "
[[ "$REPLY" == "y" ]] || exit 1
echo
msg "Removing mobile/installer\n" \
"(it's not used anymore)"
hg rm mobile/installer
msg "Moving mobile/ into mobile/xul"
hg mv mobile/ mobile/xul
msg "Moving common files back into mobile/\n" \
"(they are shared by the android and xul builds)"
hg mv mobile/xul/{profile,searchplugins,chrome/overrides} mobile/
hg mv mobile/xul/chrome/region.properties mobile/chrome/region.properties
msg "Copying mobile/xul into mobile/android"
hg cp -X mobile/xul/chrome/browser.dtd -X mobile/xul/chrome/preferences.dtd mobile/xul mobile/android
msg "Removing mobile/android/{crashreporter,updater}\n" \
"(they're not used in the android builds)"
hg forget mobile/android/{crashreporter,updater}
rm -rf mobile/android/{crashreporter,updater}
msg "Copying embedding/android into mobile/android/base"
hg cp embedding/android mobile/android/base
msg "All done!"
echo "Check hg status and exmine the contents of mobile/."
echo "If all looks good, hg commit!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment