You are not logged in.

#1 2010-11-18 20:58:27

Ryujin
Forum Fellow
From: Centerville, Utah
Registered: 2005-05-12
Posts: 246
Website

[SOLVED] mkinitcpio overwrite default_mount_handler

I am trying to boot an Arch server from a ramdisk downloaded from a pxeboot server, I have it working for Ubuntu by adding a script that overwrites the function that mounts the root filesystem, but I can't seem to get it working in Arch. I am looking at the net hook as a guide but still running into problems.
I am trying to do this by installing a hook called ramdisk into the image that changed the mount_handler variable found in the init script to point to my function, but it is still running the default_mount_handler script.

Here is my "ramdisk" hook:


run_hook ()
{
    mount_handler="ramdisk_mount_handler"
}


ramdisk_mount_handler ()
{
#  log_begin_msg "Sleeping for 15 seconds to let network interfaces show up..."
#  sleep 15
#  log_end_msg

  #For DHCP
#  modprobe af_packet
#  configure_networking

  if [ "$MGMT_URL" == "" ]; then
    panic "MGMT_URL Boot arg not found!"
  fi
  #`cat /tmp/net-eth0.conf | grep DNSDOMAIN |cut -d '=' -f2`
  HOST_URL="$MGMT_URL/`hostname`.`cat /tmp/net-eth0.conf | grep DNSDOMAIN |cut -d'=' -f2`"
  WGET_CMD="wget -q -O -"
  GZIP_CMD="gzip -dc"
  CPIO_CMD="cpio -i"

  #Make a 2GB root tmpfs partition
  mount -t tmpfs -o size=2147483648 tmpfs ${1}
  cd ${1}

  # Get the root image and unpack it
  $WGET_CMD $HOST_URL/rootimg.gz | $GZIP_CMD | $CPIO_CMD

  # Get the module files for this kernel version
  #$WGET_CMD $MGMT_URL/`uname -r`-modules.gz | $GZIP_CMD | $CPIO_CMD

  # Apply the overlay image - Pending full inclusion
  $WGET_CMD $HOST_URL/overlay.gz | $GZIP_CMD | $CPIO_CMD

  # Ensure that all mount points defined in the fstab are present - TODO move to overlay manager
  for I in $(cat etc/fstab | grep -v '^#' | awk '{print $2}'); do mkdir -p ${1}$I; done

  cd -

}

so my question is this, how do I get this function to override the default_mount_handler function?

Last edited by Ryujin (2010-11-19 18:30:15)

Offline

#2 2010-11-19 18:29:57

Ryujin
Forum Fellow
From: Centerville, Utah
Registered: 2005-05-12
Posts: 246
Website

Re: [SOLVED] mkinitcpio overwrite default_mount_handler

I got it, You need to add the SCRIPT= line in the install function in the install file

Offline

Board footer

Powered by FluxBB