b617cd1cd5c328e6cf5d524d7545e6c6254432f9
[grml-debootstrap.git] / grml-debootstrap.clp
1 # -*- shell-script -*-
2
3 #
4 # shell script command line parameter-processing for:
5 #
6 # grml-debootstrap - wrapper around debootstrap for installing plain Debian via
7 # grml
8 #
9 # @Author:  Tong SUN
10 # @Release: $Revision: 1.3 $
11 # @HomeURL: http://xpt.sourceforge.net/
12 #
13
14 # @WARNING: Do NOT modify this file without prior contacting the author.
15 # This script is use for the command line *logic* processing. It should be
16 # as dumb as possible. I.e., it should NOT be more complicated than
17 # copy-paste-and-rename from existing code. All *business-logic* processing
18 # should be handled in the main script, where it belongs.
19
20
21
22 _opt_temp=`getopt --name grml-debootstrap -o +m:i:r:t:p:c:d:vhV --long \
23     mirror:,iso:,release:,target:,mntpoint:,debopt:,interactive,nodebootstrap,config:,confdir:,packages::,debconf::,keep_src_list,hostname:,password:,bootappend:,groot:,grub:,verbose,help,version \
24   -- "$@"`
25 if [ $? != 0 ]; then
26   eerror "Try 'grml-debootstrap --help' for more information."; eend 1; exit 1
27 fi
28 eval set -- "$_opt_temp"
29
30 while :; do
31   case "$1" in
32
33   # == Bootstrap options
34   --mirror|-m)         # Mirror which should be used for apt-get/aptitude.
35     shift; _opt_mirror="$1"
36     ;;
37   --iso|-i)            # Mountpoint where a Debian ISO is mounted to, for use instead
38     shift; _opt_iso="$1"
39     ;;
40   --release|-r)        # Release of new Debian system (default: stable).
41     shift; _opt_release="$1"
42     ;;
43   --target|-t)         # Target partition (/dev/...) or directory.
44     shift; _opt_target="$1"
45     ;;
46   --mntpoint|-p)       # Mountpoint used for mounting the target system.
47     shift; _opt_mntpoint="$1"
48     ;;
49   --debopt)            # Extra parameters passed to the debootstrap.
50     shift; _opt_debopt="$1"
51     ;;
52   --interactive)       # Use interactive mode (frontend).
53     _opt_interactive=T
54     ;;
55   --nodebootstrap)     # Skip debootstrap, only do configuration to the target.
56     _opt_nodebootstrap=T
57     ;;
58   #
59
60   # == Configuration options
61   --config|-c)         # Use specified configuration file, defaults to /etc/debootstr
62     shift; _opt_config="$1"
63     ;;
64   --confdir|-d)        # Place of config files for debootstrap, defaults to /etc/debo
65     shift; _opt_confdir="$1"
66     ;;
67   --packages)          # Install packages defined in <confdir>/packages. Option arg:
68     shift; _opt_packages="$1"
69     _opt_packages_set=T
70     ;;
71   --debconf)           # Pre-seed packages using <confdir>/debconf-selections. Option
72     shift; _opt_debconf="$1"
73     _opt_debconf_set=T
74     ;;
75   --keep_src_list)     # Do not overwrite user provided apt sources.list.
76     _opt_keep_src_list=T
77     ;;
78   --hostname)          # Hostname of Debian system.
79     shift; _opt_hostname="$1"
80     ;;
81   --password)          # Use specified password as password for user root.
82     shift; _opt_password="$1"
83     ;;
84   #
85   --bootappend)        # Add specified appendline to kernel whilst booting.
86     shift; _opt_bootappend="$1"
87     ;;
88   --groot)             # Root device for usage in grub, corresponds with $TARGET in g
89     shift; _opt_groot="$1"
90     ;;
91   --grub)              # Target for grub installation. Use grub syntax for specifying
92     shift; _opt_grub="$1"
93     ;;
94
95   # == Other options
96   --verbose|-v)        # Increase verbosity.
97     if [ "$_opt_verbose" ]; then _opt_verbose=`expr $_opt_verbose + 1`
98     else _opt_verbose=1; fi
99     ;;
100   --help|-h)           # Print this usage information and exit.
101     _opt_help=T
102     ;;
103   --version|-V)        # Show summary of options and exit.
104     _opt_version=T
105     ;;
106   --)
107     shift; break
108     ;;
109   *)
110     eerror "Internal getopt error!"; eend 1 ; exit 1
111     ;;
112   esac
113   shift
114 done
115
116
117 # End