aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-10-05 14:06:50 -0300
committerSilvio Rhatto <rhatto@riseup.net>2011-10-05 14:06:50 -0300
commitdbe2deb6325bba567b6f151abeddea3abb4a9bff (patch)
treecc0da4598593c4a0424ea0db9b2406b76d2b3805
parent47f525c969eff1e7b4ce01af31a4cbcaf05664d8 (diff)
downloadhydra-dbe2deb6325bba567b6f151abeddea3abb4a9bff.tar.gz
hydra-dbe2deb6325bba567b6f151abeddea3abb4a9bff.tar.bz2
More bootless init code
-rwxr-xr-xshare/hydra/bootless59
1 files changed, 57 insertions, 2 deletions
diff --git a/share/hydra/bootless b/share/hydra/bootless
index c2621e5..a1fa76e 100755
--- a/share/hydra/bootless
+++ b/share/hydra/bootless
@@ -94,6 +94,8 @@ EOF
echo "Aborting..."
exit 1
fi
+
+ # TODO: check if $device exists
# Format and mount
$sudo mke2fs ${device}
@@ -149,9 +151,62 @@ function hydra_bootless_init {
git clone $1 $HYDRA_FOLDER/bootless
else
# Create a fresh repository
- # TODO
mkdir -p $HYDRA_FOLDER/bootless/{default,custom,grub}
- exit
+ mkdir -p $HYDRA_FOLDER/bootless/default/{debian,memtest,ubuntu}
+ ( cd $HYDRA_FOLDER/bootless && ln -s . boot)
+
+ if [ -f "/boot/memtest86+.bin" ]; then
+ cp /boot/memtest86+.bin $HYDRA_FOLDER/bootless/default/memtest
+ else
+ echo "No memtest image found. Please install memtest86+ package"
+ echo "and manually copy /boot/memtest86+.bin if you want memtest support"
+ fi
+
+ # Grub configuration
+ cat > $HYDRA_FOLDER/bootless/grub/grub.cfg <<-EOF
+# This is grub.cfg for use with Bootless Management System
+
+### BEGIN header ###
+if [ -s $prefix/grubenv ]; then
+ load_env
+fi
+set default="0"
+if [ "${prev_saved_entry}" ]; then
+ set saved_entry="${prev_saved_entry}"
+ save_env saved_entry
+ set prev_saved_entry=
+ save_env prev_saved_entry
+ set boot_once=true
+fi
+
+function savedefault {
+ if [ -z "${boot_once}" ]; then
+ saved_entry="${chosen}"
+ save_env saved_entry
+ fi
+}
+
+function load_video {
+}
+
+set timeout=5
+### END header ###
+
+### BEGIN debian_theme ###
+set menu_color_normal=white/blue
+set menu_color_highlight=yellow/red
+### END debian_theme ###
+EOF
+
+ # Initialize git repository
+ (
+ cd $HYDRA_FOLDER/bootless
+ git init
+ git add .
+ git commit -a -m "Initial import"
+ )
+
+ echo "Now add your boot images and edit $HYDRA_FOLDER/bootless/grub/grub.cfg to suit your needs."
fi
}