]> gitweb.fluxo.info Git - hydra.git/commitdiff
More bootless init code
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 5 Oct 2011 17:06:50 +0000 (14:06 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 5 Oct 2011 17:06:50 +0000 (14:06 -0300)
share/hydra/bootless

index c2621e5c32d61adc7b53509f1ff300bf776ec93e..a1fa76e0f5e41ab393f09e468a42adff91f9d433 100755 (executable)
@@ -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
 }