Ignore:
Timestamp:
May 15, 2012, 10:10:24 PM (13 years ago)
Author:
rick
Message:

Set the prompt to avoid confusion. While here merge to ./image framework. So
calling it should be now:

./tools/image edit

Reported-By: huub@
Fixes: nodefactory:ticket:179

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/releng-9.0/nanobsd/tools/image

    r10830 r10871  
    2020# build force kernel            - Build NanoBSD and force rebuilding the kernel
    2121# build force world             - Build NanoBSD and force rebuilding world
     22# edit                          - Manually edit the image
    2223# config [for <node>]           - Configure image to be used for <node>
    2324# rebuild                       - Rebuild NanoBSD (aka force rebuilding all)
     
    7778  # Try to fetch and store config
    7879  chroot $mnt /tools/wl-config -d -n -m startup $node_name || exit 1
     80}
     81
     82edit_image() {
     83  img=$OBJDIR/_.disk.full
     84
     85  mnt=`mktemp -d -t $(basename $0)`
     86  md=`mdconfig -a -t vnode -f $img`
     87 
     88  # Clean up when done
     89  trap "umount $mnt/dev; umount $mnt/cfg; umount $mnt; mdconfig -d -u $md; rm -d $mnt" 0
     90  trap "exit 1" 1 2 3 15
     91
     92  # Root filesystem
     93  mount /dev/${md}s1a $mnt || exit 1
     94
     95  # /dev/null in chroot
     96  mount -t devfs devfs ${mnt}/dev || exit 1
     97 
     98  # Config files lives at /cfg  location
     99  mount /dev/${md}s3 $mnt/cfg || exit 1
     100
     101  # Nasty hack to set custom prompt
     102  prompt='set prompt = "image# "'
     103  echo $prompt >> $mnt/root/.cshrc
     104 
     105  p_info "Type exit when done"
     106  chroot $mnt
     107  p_info "Any changes are made permanent on image $img"
     108 
     109  # Unset prompt again
     110  sed -I '' "/^$prompt$/d" $mnt/root/.cshrc
    79111}
    80112
     
    213245  fi
    214246  config_image $node_name
     247elif [ "$1" = "edit" ]; then
     248  edit_image
    215249else
    216250  echo "Argument Error - '$1'"; exit 128
Note: See TracChangeset for help on using the changeset viewer.