SHARE
TWEET

ubuntu 14 preseed repack initrd

peetaur Jul 11th, 2014 201 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Copies to the initrd, and also to the web dir but doesn't get used there.
  2. installfiles() {
  3.     seedfile="$1"
  4.     seedfilename=$(basename "$seedfile")
  5.    
  6.     basedir=/srv/tftp/netboot/ubuntu14.04/
  7.     webdir=/srv/www/netboot/ubuntu14.04
  8.    
  9.     if [ ! -e "$seedfile" ]; then
  10.         echo "ERROR: could not find seed file: $seedfile"
  11.         return 3
  12.     fi
  13.    
  14.     echo "Copying \"$seedfile\" to \"$webdir\""
  15.     cp "$seedfile" "$webdir"
  16.    
  17.     echo "Unpacking initrd.gz"
  18.     mkdir -p "$basedir"/tmp
  19.     rm -r "$basedir"/tmp/*
  20.     if [ ! -e "$basedir"/tmp/ ]; then
  21.         echo "ERROR: tmp dir could not be created"
  22.         return 1
  23.     fi
  24.     if [ ! -e "$basedir"/ubuntu-installer/amd64/initrd.gz ]; then
  25.         echo "ERROR: initrd.gz not found"
  26.         return 2
  27.     fi
  28.     cd "$basedir"/tmp/
  29.     gunzip -c "$basedir"/ubuntu-installer/amd64/initrd.gz | cpio -i
  30.    
  31.     echo "Packing \"$seedfilename\" into the initrd.gz (renamed to pressed.cfg)"
  32.     cp "$webdir"/"$seedfilename" preseed.cfg
  33.     find | cpio --create --format='newc' | gzip -c > "$basedir"/ubuntu-installer/amd64/initrd.gz
  34.    
  35.     echo "done"
  36. }
  37.  
  38. installfiles ~/ubuntu14.seed
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top