Finding Haiku stable enough to use on a daily basis, but also finding bugs, I’ve found lately that to make sure I’m not reporting something that is fixed in the latest nightly, I download and install nightlies quite a bit. Personally, I have two Haiku partitions, one “stable” and one “nightly”. After the Nth time of doing a bunch of manual tasks to accomplish setting my Haiku nightly the way I like it after a fresh install, I thought, why I don’t I write a simple script that I can launch from “stable” that will back up a few basic settings and my desktop, download the latest nightly, wipe out my “nightly” partition, install the latest, and put my settings back.
I can hear a few possible objections:
- it’s not generally accepted to have the “general public” using nightlies all the time
- settings files might change format, so this might cause problems
- not everyone has two dedicated Haiku partitions so this might be of limited usefulness
- using cp -r instead of the Installer may not be a supported installation method
Nonetheless, if you’re actively testing things, happen to have two partitions, and don’t mind working with the caveat of changing settings file formats, I thought it might be useful. For me, it just means that the longer parts (downloading, backing up/restoring, copying) can be run back-to-back unattended, so I can do this and go for a lunch break or whatever, without having to run back every few minutes, and expect a fresh, current desktop when I return.
As for Installer if someone could advise that’d be great. I think I was once told this but the issue was more that I was dragging and dropping over an existing install, rather than wiping it clean and then copying all files.
Would anybody be interested in it? Or did everybody else write their own version of this a long time ago? :-]
Update: Okay, if ModeenF is interested, that’s good enough for me. Also updated to incorporate SuperUser answers. There are some assumptions:
- your nightly volume is /Haiku-testing/
- you want the latest gcc4hybrid .tar.xz
- you don’t mind keeping old images in ~ (the script lets you specify an old image .tar.xz on the command line if you want to revert to it)
- there are certain files you want to back up and certain ones you want to unzip after a reinstall–these probably won’t be what you want!
5. your /Haiku-testing/ partition is /dev/disk/ata/0/master/3
So with that and the assumption that this will destroy everything (after all, it does contain an rm -r command) and you accept all responsibility for using it, you might find this a useful starting point:
#! /bin/sh set -e # HAIKU_FILES_URL=http://www.haiku-files.org/unsupported-builds/x86-gcc4hybrid/ HAIKU_FILES_URL=http://www.haiku-files.org/haiku/development/ HAIKU_TAR_XZ=$1 cd ~ if [ ! -e $HAIKU_TAR_XZ ]; then echo "$HAIKU_TAR_XZ not found" HAIKU_TAR_XZ= fi if [ "$HAIKU_TAR_XZ" == "" ]; then echo "Getting latest Haiku version (you can also supply a .tar.xz filename on the command line)" wget -q $HAIKU_FILES_URL -O latest-haiku.html HAIKU_TAR_XZ=`perl -ne 'print if /VMDK/../raw\.tar\.xz/' ~/latest-haiku.html | perl -ne '/\.\/(.*raw\.tar\.xz)/;print $1'` rm latest-haiku.html fi read -r -p "Are you sure you want to back up only part of /Haiku_Nightly, trash it, then install $HAIKU_TAR_XZ? [y/N]" YESNO if [ "$YESNO" != "y" ]; then echo >&2 "Aborting" exit 1 fi if [ ! -e $HAIKU_TAR_XZ ]; then wget $HAIKU_FILES_URL$HAIKU_TAR_XZ fi echo "Backing up some settings, ~/config/bin, ~/setup, and ~/Desktop from /Haiku_Nightly" unmount /Haiku_Nightly if [ -e /Haiku_Nightly/_HaikuAutoCreated ]; then rmdir /Haiku_Nightly/_HaikuAutoCreated rmdir /Haiku_Nightly fi mkdir /Haiku_Nightly mount /dev/disk/ata/0/master/0_2 /Haiku_Nightly TIMESTAMP=`date +%Y%m%d%H%M` checkfs /boot set +e zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/config/settings/time_dststatus zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/config/settings/shortcuts_settings zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/config/settings/Key_map zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/config/settings/RTC_time_settings zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/config/settings/Time\ settings zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/config/settings/Keyboard_settings zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/config/settings/Tracker/TrackerSettings zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/config/non-packaged/bin/* # following line for cronie port zip -yr Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/apps/* zip -yr Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/notes/* zip -yr Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/notes/.hg/* zip -yr Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/todo/* zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/* zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/.* zip -yr Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/setup/* zip -yr Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/Desktop/* -x Home # it's possible the next line may not be a good idea, but I want a fifth screen... zip Haiku_Nightly-backup-$TIMESTAMP.zip /boot/home/config/settings/Screen_data zip -yr Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/config/settings/WebPositive/* # zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/config/settings/WebPositive/Bookmarks/* zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/system/settings/etc/profile.d/bash_completion_todo.sh zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/system/settings/etc/profile.d/kevhome.sh # the following line is a workaround for the bug where shortcuts don't work out-of-the-box since some time after the last alpha zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/config/non-packaged/add-ons/input_server/filters/shortcut_catcher zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/config/settings/pe/keybindings zip Haiku_Nightly-backup-$TIMESTAMP.zip /Haiku_Nightly/home/config/settings/boot/launch/* set -e echo "Unzipping Haiku image" tar -x --xz -f $HAIKU_TAR_XZ mkdir /ht mount haiku-nightly.image /ht echo "Trashing /Haiku_Nightly/" unmount -f /Haiku_Nightly/ mkfs -q -t bfs /dev/disk/ata/0/master/0_2 Haiku_Nightly mount /dev/disk/ata/0/master/0_2 /Haiku_Nightly echo "Installing $HAIKU_TAR_XZ" cp -Rd /ht/* /Haiku_Nightly/ unmount /ht makebootable /Haiku_Nightly echo "Restoring backup" cd / set +e unzip -o ~/Haiku_Nightly-backup-$TIMESTAMP.zip set -e echo "Tidying up" cd ~ rm haiku-nightly.image rm ReadMe.txt shutdown -r
-K
PS If anyone wants to help me improve this script, I have a couple SuperUser questions unanswered:
(new one not in original post) http://superuser.com/questions/579836/how-to-get-something-to-start-on-next-startup-only-one-time-in-haiku