# refracta.freeforums.org

place to talk about refracta

Skip to content

Welcome
Welcome to refracta You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!

## Alternative usb installation method, part 2

Stuff that has not yet gone into the official build.
Post a reply
153 posts • Page 8 of 16 • 1 ... 5, 6, 7, 8, 9, 10, 11 ... 16

### Re: Alternative usb installation method, part 2

by fsmithred » Mon Dec 23, 2013 6:05 pm

(dead link removed)
Last edited by fsmithred on Wed Jan 01, 2014 5:44 pm, edited 1 time in total.

fsmithred
  Posts: 2101
  Joined: Wed Mar 09, 2011 9:13 pm

Top

### Re: Alternative usb installation method, part 2

by fsmithred » Tue Dec 24, 2013 12:47 pm

Thought I'd post this for anyone interested in the code.
This block from copy_livemount didn't do what was expected. If $save_syslinux is true, and $usb_mountpoint/syslinux exists, then a warning message with no text comes up.

Code: Select all
  `if [[ $save_syslinux = "TRUE" ]] ; then
  [[ -e "$usb_mountpoint"/syslinux ]] || \
  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`

(and-or-and-and-and)
This one does what it's supposed to do - it gives a warning if there's no syslinux folder to save.

Code: Select all
  `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`

fsmithred
  Posts: 2101
  Joined: Wed Mar 09, 2011 9:13 pm

Top

### Re: Alternative usb installation method, part 2

by dzz » Tue Dec 24, 2013 6:46 pm

> 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?

You still need a vmlinuz and initrd in the same way as squash boot. Example menu entry, with iso named sidsnap.iso, vmlinuz and initrd placed in directory /sid:

Code: Select all
  `label Sid snap
  menu Sid snap findiso
  kernel /sid/vmlinuz
  append initrd=/sid/initrd.img boot=live union=aufs findiso=/sid/sidsnap.iso`

There is also "fromiso" but I never got that to work in a useful way. I think you have to specify /dev/whatever .. who knows what is that from one machine to another?
One advantage of "findiso" (apart from not needing to extract the squash) is the actual iso remains intact and available from a live session. You can burn a cd from it, copy it to another disk, ...

dzz
  Posts: 647
  Joined: Wed Apr 27, 2011 11:53 am
  Location: Devon, England

Top

### Re: Alternative usb installation method, part 2

by fsmithred » Wed Dec 25, 2013 3:32 pm

So, I think the new parts will look something like this. These functions are modified versions of copy_iso and setup_multiboot. I need to add something to check for an existing syslinux folder, and either copy or create one if there is none, or else this task needs to be run on an already working live-usb that has a syslinux folder. (Same as multiboot.)

Code: Select all
  `# Select iso file, mount it, select kernel and initrd from mounted iso.
  # Copy kernel, initrd and iso file to same target directory.
  copy_iso_file () {
  isofile=$($DIALOG --file-selection --file-filter="*.[iI][sS][oO]" --file-filter="*" \
  --width=640 --height=640 --title=$"Select Live ISO" --text="Select the CD image file." \
  --filename="" ${OKBUTTON} ${QUITBUTTON})
  if [[ $? = 1 ]] ; then
  cleanup
  run_task
  fi
  if [[ -z "$isofile" ]]; then
  exit_message="\nYou did not select a CD image file."
  exit_dialog
  fi
  if ! $(echo $isofile | grep -q .[Ii][Ss][Oo]$); then
  exit_message="\nYou did not select a CD image file.."
  exit_dialog
  fi
  fuseiso -p "$isofile" "$image_mountpoint"
  image_size=$(du -h "$isofile" )
  check_size
  kernel_image=$($DIALOG --file-selection --width=640 --height=640 \
  --title=$"Select kernel image" --text="Select the kernel image file." \
  --filename="${image_mountpoint}/*" ${OKBUTTON} ${QUITBUTTON})
  if [[ $? = 1 ]] ; then
  cleanup
  run_task
  fi
  if [[ -z "$kernel_image" ]]; then
  exit_message="\nYou did not select a kernel image file."
  exit_dialog
  fi
  initrd_image=$($DIALOG --file-selection --width=640 --height=640 \
  --title=$"Select initrd image" --text="Select the initrd image file." \
  --filename="${image_mountpoint}/*" ${OKBUTTON} ${QUITBUTTON})
  if [[ $? = 1 ]] ; then
  cleanup
  run_task
  fi
  if [[ -z "$initrd_image" ]]; then
  exit_message="\nYou did not select an initrd image file."
  exit_dialog
  fi
  cp "$kernel_image" "$usb_mountpoint"/${target_dir}
  cp "$initrd_image" "$usb_mountpoint"/${target_dir}
  cp "$isofile" "$usb_mountpoint"/${target_dir}
  sleep 2
  fusermount -u "$image_mountpoint"
  finished_message="ISO file copied."
  finished_dialog
  }
  setup_findiso () {
  target_name=$($DIALOG --entry --title=$TITLE --text=" For multi-boot live-USB, a CD image will be copied to its own directory on your USB drive.
  Enter a name for that directory. The name will also be used in your boot menu. " \
  --${BUTTON0}="OK"${BUTTON0NUM} --${BUTTON1}="Exit"${BUTTON1NUM})
  if [[ $? = 1 ]] ; then
  cleanup
  exit 0
  fi
  if [[ -n $target_name ]] ; then
  target_dir="${target_name}/"
  target_message="Target directory: /$target_dir"
  else
  target_dir=""
  exit_message="No target directory selected for iso file. "
  exit_dialog
  fi
  kernel_name="${kernel_image##*/}"
  initrd_name="${initrd_image##*/}"
  isofile_name="${isofile##*/}"
  menu_text="
  label $target_name
  menu label $target_name
  kernel /${target_name}/${kernel_name} quiet
  append initrd=/${target_name}/${initrd_name} boot=live ip=frommedia union=aufs findiso=/${target_name}/${isofile_name}
  "
  echo "$menu_text" > /tmp/boot_menu_text
  }
  if [[ $adv_opt =~ Boot_ISO ]] ; then
  image_mountpoint="/tmp/isomount"
  check_device
  usb_mountpoint="/media/${device##*/}1"
  pmount ${device}1
  setup_findiso
  copy_iso_file
  finished_message=" An entry for $target_name will be
  added to your boot menu, and the menu will be
  opened in a text editor for your review. "
  finished_dialog
  if [[ -f /tmp/boot_menu_text ]] ; then
  edit_boot_menu
  rm -f /tmp/boot_menu_text
  fi
  fi
  `

fsmithred
  Posts: 2101
  Joined: Wed Mar 09, 2011 9:13 pm

Top

### Re: Alternative usb installation method, part 2

by fsmithred » Fri Dec 27, 2013 11:23 am

Just a single script:
(dead link removed)
You can try this if you want. I'll probably get a chance to test it later today. Tested an earlier version, and it almost worked - it didn't have all the variables filled for creating the menu, so I had to edit manually. Other than that it worked, and I was able to boot the iso file. Look for Boot_ISO, on the advanced menu, right after Multiboot.
Last edited by fsmithred on Wed Jan 01, 2014 5:45 pm, edited 1 time in total.

fsmithred
  Posts: 2101
  Joined: Wed Mar 09, 2011 9:13 pm

Top

### Re: Alternative usb installation method, part 2

by fsmithred » Fri Dec 27, 2013 3:45 pm

fixed a typo in that last script. Change "%usb_mountpoint" to "$usb_mountpoint". It works.
From Advanced Menu, select Boot_ISO
Select CD image file.
Enter a name for the folder to hold the iso file, kernel and initrd (and isolinux dir.)
Select the kernel and initrd.
Select boot menu file.
Review the boot menu.
If there's not already a syslinux folder in the root of the target device, it will copy the isolinux directory as syslinux. This happens before you select the boot menu file. If there is already a syslinux folder, the script will copy the isolinux folder to the target directory and convert it to syslinux, in case you need to look at it or copy any entries that are specific to the iso file you copied.
It works.
Edit: Here's the deb -
(dead link removed - see later posts)
Edit2: use p not n. If the syslinux folder gets copied from isolinux, then install_syslinux needs to run. (Don't need to install it to mbr again.)
Last edited by fsmithred on Wed Jan 01, 2014 5:46 pm, edited 1 time in total.

fsmithred
  Posts: 2101
  Joined: Wed Mar 09, 2011 9:13 pm

Top

### Re: Alternative usb installation method, part 2

by fsmithred » Sun Dec 29, 2013 8:43 pm

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

Code: Select all
  `refracta2usb (0.9.4q) unstable; urgency=low
  * Added option for user-set loopback file size.
  * Moved function check_size to functions file, so mkloopback could use it.
  * Renamed mkloopback.sh to mkloopback.
  * Update (replace_live) now works with multiboot.
  -- fsmithred <[email protected]
  > Sun, 29 Dec 2013 14:35:00 -0500`

fsmithred
  Posts: 2101
  Joined: Wed Mar 09, 2011 9:13 pm

Top

### Re: Alternative usb installation method, part 2

by fsmithred » Tue Dec 31, 2013 8:17 pm

Mount Loop won't mount an encrypted loopfile. The test for that needs to be changed. Starting at line 82 of /usr/bin/select-loop-mount, this will work (there might be a better test, but this is what I came up with for now.)

Code: Select all
  `if ! $(file "$loopfile" | grep -q "filesystem data") ; then
  if ! $(file "$loopfile" | grep -q "LUKS") ; then
  warning_message="That does not look like a loopback file. Try again."
  warning_dialog
  umount -l "$selected_partition"
  exit 1
  fi
  fi`

Also, check_exit reports the wrong exit code. This way works better.

Code: Select all
  `check_exit () {
  exit_code="$?"
  if [[ $exit_code -ne 0 ]] ; then
  $DIALOG --question --title="$TITLE error" --window-icon=error \
  --${BUTTON0}="Continue"${BUTTON0NUM} --${BUTTON1}="Exit"${BUTTON1NUM} \
  --text="Error detected: $exit_code $error_message
  \nSee $error_log for details. Press \"Continue\" to proceed anyway"
  if [[ $? -ne 0 ]] ; then
  cleanup
  exit 1
  fi
  fi
  }`

The first test (for the loopback file) could be eliminated, and if the mount fails, check_exit will pick it up. (But you'll get exit code 32, and you won't get a message that says "This does not look like a loopback file.")

fsmithred
  Posts: 2101
  Joined: Wed Mar 09, 2011 9:13 pm

Top

### Re: Alternative usb installation method, part 2

by fsmithred » Wed Jan 01, 2014 4:49 pm

Gonna run out of alphabet soon...
http://distro.ibiblio.org/refracta/file ... 0.9.4r.deb

Code: Select all
  `refracta2usb (0.9.4r) unstable; urgency=low
  * select-loop-mount now recognizes encrypted loopback file.
  * Fixed bug in function check_exit that reported wrong exit code.
  -- fsmithred <[email protected]
  > Sun, 01 Jan 2014 11:45:00 -0500`

fsmithred
  Posts: 2101
  Joined: Wed Mar 09, 2011 9:13 pm

Top

### Re: Alternative usb installation method, part 2

by dzz » Thu Jan 02, 2014 3:41 pm

Back from the Christmas break and fired up my trusty tower, so can revisit r2u..
First test: add a sid iso to a 2GB stick after deleting old stuff (including /syslinux) manually. To directory /sid and boot "findiso"
A default live.cfg was copied in and correctly appended with an entry to boot the iso. When the menu opened for editing then I reviewed it and removed the default entries. It boots fine on my test box.
More later.
BTW mountpoints in this mode are:
Device partition: /lib/live/mount/findiso/
ISO image: /lib/live/mount/medium/
Squashfs: /lib/live/mount/rootfs/filesystem.squashfs/

dzz
  Posts: 647
  Joined: Wed Apr 27, 2011 11:53 am
  Location: Devon, England

Top

Previous Next Display posts from previous:
Sort by

Post a reply
153 posts • Page 8 of 16 • 1 ... 5, 6, 7, 8, 9, 10, 11 ... 16

Return to Experimental

Jump to:

### Who is online

Users browsing this forum: No registered users and 0 guests

Donate Now
ProNight Style by ModphpBB3
Hosted by © 2017 FreeForums.org | Create a free forum | Powered by phpBB
A Member of the Crowdgather Forum Community
About FreeForums | Legal | Advertise Here | Investors | Contact FreeForums.org
Report Violation
suspicion-preferred