Stuff that has not yet gone into the official build.
Post a reply

Re: Alternative usb installation method, part 2

Mon Dec 16, 2013 8:06 pm

Just tried the latest in live usb mode, it still tries to copy the entire boot device contents, all 13G of it, to a 2G pen. Only /live (or other "live-media-path") and the syslinux files should be copied.

Re: Alternative usb installation method, part 2

Mon Dec 16, 2013 11:22 pm

Sorry about that - I screwed up. Too many copies of the script lying around, and the wrong one went into the deb. It's missing the last edits of copy_livemount function, and at the top of the script, it tests for $HOME/refracta2usb instead of $HOME/.refracta2usb. So you're not even getting a logfile, because the right directory doesn't exist. Gonna fix all that now. It really does work, when you have all the right parts.

0.9.4h is up. I'm going to test it now.

Re: Alternative usb installation method, part 2

Tue Dec 17, 2013 12:04 am

Seems to be working correctly now - again. (It did work for me before, when I was running the right script.)

Too much going on, and I have a cold. Blame it on that. BTW, the refracta2usb script probably needs 'exit 0' at the end. You'll notice that if you start it in a terminal.

http://distro.ibiblio.org/refracta/file ... 0.9.4h.deb

Be aware that $save_syslinux is TRUE, so if you're adding to a multiboot (from live session only), the syslinux folder, your boot menu, will be unchanged. The syslinux folder for the added (new) system will be saved as syslinux.new-<date-time>. Maybe I should add this to copy_iso, too.

You can change that behavior in the Setup Options. (Un-check 'Preserve Syslinux' and the new syslinux folder will be used. The old one will be saved with date-time stamp.)

Re: Alternative usb installation method, part 2

Wed Dec 18, 2013 3:39 pm

Getting there (live-copy).. This time, with the same test conditions, the "live-media-path" directory only was copied. Then a dialog appeared to say no syslinux directory was found and offered to copy a default one (which of course will have the wrong menu). I noticed /syslinux from the boot device was copied also but renamed, so at least that was available for reference.

It would have been better to copy the $bootdevice/syslinux .. at least one correct menu entry would be there.

It might have something to do with how Refracta (and standard debian-live images) uses multiple menus, e.g. "live.cfg" which I don't normally do (I find it confusing) There are other syslinux/isolinux-supported ways to organise and simplify menus. It can be done with a single syslinux.cfg file.

Very limited time just now to look into this in more detail, more later.

Re: Alternative usb installation method, part 2

Wed Dec 18, 2013 6:35 pm

I think it's because I changed $save_syslinux to TRUE, and there's no test to make sure that there's a syslinux folder to save. If that option is set to FALSE, then you would get the one from the boot device (actually from $image_mountpoint). Either way, true or false, I need to add a test or two. When I had it set to false, I kept forgetting to change it, and I kept losing the boot menu that I wanted to keep.

Re: Alternative usb installation method, part 2

Sat Dec 21, 2013 9:49 pm

Edit: See next post for updated link.

Here are the fixes. $save_syslinux is FALSE, and there are tests and warnings for pre-existing syslinux or live folders or missing syslinux folder. Only tested partially so far. I'll be able to do more testing on Monday.
Last edited by fsmithred on Sun Dec 22, 2013 4:15 pm, edited 1 time in total.

Re: Alternative usb installation method, part 2

Sun Dec 22, 2013 4:13 pm

(dead link removed - see later posts)

Added a test to select-loop-mount to make sure you selected a loopback file. (I selected a directory by mistake, and it got kind of messy.)
Last edited by fsmithred on Wed Jan 01, 2014 5:47 pm, edited 1 time in total.

Re: Alternative usb installation method, part 2

Mon Dec 23, 2013 12:09 am

Thanks fsr, great work. I can't test for a few days, too much else going on Christmas week. Will look at the new stuff when I can. I then want to see what happens with "findiso" boot.

Travelling kit only just now. This ageing laptop still has only squeeze installed but runs sid from usb pen quite nicely.

Re: Alternative usb installation method, part 2

Mon Dec 23, 2013 3:34 pm

Started testing 0.9.4k copy_livemount.

Booted from live folder, copying to a device that already has a live folder. Made the following changes:
line 330: add "cleanup" before the exit 0 (in the "Don't overwrite" section.)
line 340: remove --exclude-from="$excludes_file"
line 1070: add "cleanup" after install_syslinux
line 370: added info window to say that old syslinux folder was saved as syslinux-(date-time)

I'll probably put a new deb up tonight or tomorrow morning.


Re: findiso
Is it necessary to put vmlinuz and initrd with the iso file and name them on the boot cmdline? Or does live-boot just find the iso and boot from that?

Re: Alternative usb installation method, part 2

Mon Dec 23, 2013 5:18 pm

This is here so I can find it easily when I get home (and so I don't accidentally wipe it from the thumb drive.) This one gives a warning if the live-media-path exists on the target device, whether it's named /live or /something-else

Code:
# Copy system from the running live system
# If system is running from a custom live-media-path, copy from there.
copy_livemount () {
   
   if [[ $copy_syslinux = "TRUE" ]] && [[ $save_syslinux = "TRUE" ]] ; then
      conflict_warning
      return
   fi

   if [[ $save_syslinux = "TRUE" ]] ; then
      if ! [[ -e "$usb_mountpoint"/syslinux ]] ; then
         warning_message="Options are set to save the existing syslinux folder, but there is none.
Check the Setup Options and un-check Preserve existing syslinux to use the one from
the currently running system."
         warning_dialog
         setup_options
         return
      fi
   fi

   live_dir=$(grep -o "live-media-path=.*" /proc/cmdline |sed 's: .*::' |sed 's:live-media-path=/::' |sed 's:/live::')
   if [[ -z "$live_dir" ]] ; then
      live_dir="live"
   fi

   # Don't overwrite an existing /live folder without warning.
#   if [[ $live_dir = "live" ]] ; then
      if [[ -e "$usb_mountpoint"/"$live_dir" ]] ; then
         $DIALOG --$WARNING --title="$TITLE"   --text="A $live_dir folder already exists on the target usb drive. If you Proceed, it will be replaced
with the one from the currently running system. If you don't want that, then exit." \
         --${BUTTON0}="Continue"${BUTTON0NUM} --${BUTTON1}="Exit"${BUTTON1NUM}
            if [[ $? = 1 ]] ; then
               cleanup
               exit 0
            else
               rm -rf "$usb_mountpoint"/"$live_dir"
            fi
      fi
#   fi

   image_size=$(du -sh ${image_mountpoint}/${live_dir})
   check_size

   rsync -av "$image_mountpoint"/${live_dir} "$usb_mountpoint"

   if [[ -e "$image_mountpoint"/isolinux ]] ; then
      if [[ $save_syslinux = "TRUE" ]] ; then
         cp -a "$image_mountpoint"/isolinux "$usb_mountpoint"/isolinux-$(date +%m%d%H%M)
      elif [[ $copy_syslinux = "TRUE" ]] ; then
         rsync -av "$image_mountpoint"/isolinux "$usb_mountpoint"
         mv "$usb_mountpoint"/isolinux "$usb_mountpoint"/isolinux-$(date +%m%d%H%M)
         if [[ -e "$usb_mountpoint"/syslinux ]] ; then
            mv "$usb_mountpoint"/syslinux "$usb_mountpoint"/syslinux-$(date +%m%d%H%M)
         fi
         rsync -av /usr/lib/refracta2usb/syslinux "$usb_mountpoint"   
      else
         rsync -av "$image_mountpoint"/isolinux "$usb_mountpoint"
         isolinux2syslinux
      fi
   elif [[ -e "$image_mountpoint"/syslinux ]] ; then
      if [[ $save_syslinux = "TRUE" ]] ; then
         cp -a "$image_mountpoint"/syslinux "$usb_mountpoint"/syslinux.new-$(date +%m%d%H%M)
      elif [[ $copy_syslinux = "TRUE" ]] ; then
         if [[ -e "$usb_mountpoint"/syslinux ]] ; then
            mv "$usb_mountpoint"/syslinux "$usb_mountpoint"/syslinux.orig-$(date +%m%d%H%M)
         fi
         rsync -av "$image_mountpoint"/syslinux "$usb_mountpoint"
         mv "$usb_mountpoint"/syslinux "$usb_mountpoint"/syslinux.new-$(date +%m%d%H%M)
         rsync -av /usr/lib/refracta2usb/syslinux "$usb_mountpoint"
      else
         if [[ -e "$usb_mountpoint"/syslinux ]] ; then
            mv "$usb_mountpoint"/syslinux "$usb_mountpoint"/syslinux.orig-$(date +%m%d%H%M)
            $DIALOG --$INFO --title="$TITLE" --text="An existing syslinux folder on the target device
was saved as syslinux.orig-(date-time). " --${BUTTON0}="OK"${BUTTON0NUM}
         fi
         rsync -av "$image_mountpoint"/syslinux "$usb_mountpoint"
      fi
   fi      

   if [[ $add_hooks = "TRUE" ]] ; then
      echo " Adding Refracta custom hooks..."
      rsync -av /usr/lib/refracta2usb/hooks "$usb_mountpoint"/${live_dir}
   fi
   finished_message="Live image copied."
   finished_dialog
}
Post a reply