From e7d5c75dce28921de0dc981ed840205a67a0c0e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 10 Aug 2010 10:03:11 +0000 Subject: [PATCH] Small script to bootstrap Haiku from Haiku. It downloads the latest image, mounts it, copy files over the target partition, copy extra files, schedules installing optional packages on next reboot and runs makebootable. Use with caution. Grenoble rulz! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38000 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- 3rdparty/mmu_man/scripts/bootstrap-haiku.sh | 86 +++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100755 3rdparty/mmu_man/scripts/bootstrap-haiku.sh diff --git a/3rdparty/mmu_man/scripts/bootstrap-haiku.sh b/3rdparty/mmu_man/scripts/bootstrap-haiku.sh new file mode 100755 index 0000000000..0885f134b4 --- /dev/null +++ b/3rdparty/mmu_man/scripts/bootstrap-haiku.sh @@ -0,0 +1,86 @@ +#!/bin/sh + +cd "$(dirname "$0")" + +DESTVOL=/haiku +LOOPVOL=/loopimg + +warn () { + alert --warning "$*" "Ok" +} + +error () { + alert --stop "$*" "Ok" + exit 1 +} + +log () { + echo "$*" +} + + +if [ ! -d "$DESTVOL" ]; then + error "$DESTVOL not mounted" + exit 1 +fi + + +find_current_revision () { + log "Getting url of latest revision..." + tf=/tmp/haiku-files.org_raw_$$ + wget -O $tf http://haiku-files.org/raw/ >/dev/null 2>&1 || error "wget error" + url="$(grep -m1 'http:.*nightly-.*gcc2hybrid-raw.zip' "$tf" | sed 's/.*href="//;s/".*//')" + test -n "$url" || error "cannot find latest build" + file="${url##*/}" + rm "$tf" +} + + +download_current_revision () { + #if [ ! -e "$file" ]; then + log "Downloading latest revision: $file" + wget -c "$url" || error "cannot download latest revision" + #fi +} + + +unzip_current_revision () { + if [ ! -e "haiku-nightly.image" ]; then + log "Unziping..." + unzip "$file" + fi +} + + +install_current_revision () { + mkdir -p "$LOOPVOL" + sync + mount -ro "$PWD/haiku-nightly.image" "$LOOPVOL" || error "mount" + sync + + copyattr -r -d "$LOOPVOL"/* "$DESTVOL/" + sync + unmount "$LOOPVOL" +} + + +makebootable_install () { + log "Making the partition bootable..." + makebootable "$DESTVOL/" +} + + +customize_install () { + log "Copying files..." + copyattr -r -d files/* "$DESTVOL/" +} + + + +find_current_revision +download_current_revision +#file=haiku-nightly-r37641-x86gcc2hybrid-raw.zip +unzip_current_revision +install_current_revision +makebootable_install +customize_install