# -*- shell-script -*- # # shell script command line parameter-processing for: # # mkboot - generic boot loader installer. # # @Author: Tong SUN # @Release: $ $Revision: 1.1 $, under the BSD license # @HomeURL: http://xpt.sourceforge.net/ # # @WARNING: Do NOT modify this file without prior contacting the author. # This script is use for the command line logic processing. It should be # as dumb as possible. I.e., it should NOT be more complicated than # copy-paste-and-rename from existing code. All business logic processing # should be handled in the main script, where it belongs. # {{{ LICENSE: # Copyright (c) 2006-2008, Tong Sun, xpt.sf.net # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the XPT nor the names of its contributors may be # used to endorse or promote products derived from this software without # specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # }}} eval set -- `getopt \ -o +b:maih --long \ boot:,tombr,active,initmbr,slmbr,distro:,lilo:,syslin:,clear,help \ -- "$@"` while :; do case "$1" in # == Installation options --boot|-b) # boot loader [syslinux|grub|grub4dos] shift; _opt_boot="$1" ;; --tombr|-m) # toggle installing to MBR (on) or partition (off) if [ "$_opt_tombr" ]; then _opt_tombr= else _opt_tombr=T; fi ;; --active|-a) # toggle activating current partition if [ "$_opt_active" ]; then _opt_active= else _opt_active=T; fi ;; --initmbr|-i) # toggle initialzing MBR if [ "$_opt_initmbr" ]; then _opt_initmbr= else _opt_initmbr=T; fi ;; --slmbr) # toggle using MBR from syslinux (on) or lilo (off) if [ "$_opt_slmbr" ]; then _opt_slmbr= else _opt_slmbr=T; fi ;; # == Distro specific options --distro) # distro name shift; _opt_distro="$1" ;; --lilo) # where is lilo shift; _opt_lilo="$1" ;; --syslin) # where is syslinux shift; _opt_syslin="$1" ;; # == Other options --clear) # toggle clearing screen between steps if [ "$_opt_clear" ]; then _opt_clear= else _opt_clear=T; fi ;; --help|-h) # show this help _opt_help=T ;; --) shift; break ;; *) echo "Internal getopt error ($1)!"; exit 1 ;; esac shift done [ "$_opt_boot" ] || { echo "Mandatory option --boot is not set." _opt_check_failed=T } [ "$_opt_distro" ] || { echo "Mandatory option --distro is not set." _opt_check_failed=T } [ "$_opt_lilo" ] || { echo "Mandatory option --lilo is not set." _opt_check_failed=T } [ "$_opt_syslin" ] || { echo "Mandatory option --syslin is not set." _opt_check_failed=T } # End