4e43b4a47c7037f53b202414b0892f402c85ec36
[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.2 $, under the BSD license
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:d:c:hv --long \
23     mirror:,iso:,release:,target:,mntpoint:,debopt:,interactive,confdir:,config:,packages::,debconf::,keep_src_list,hostname:,password:,bootappend:,groot:,grub:,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   #
56
57   # == Configuration options
58   --confdir|-d)        # Place of config files for debootstrap, defaults to /etc/debo
59     shift; _opt_confdir="$1"
60     ;;
61   --config|-c)         # Use specified configuration file, defaults to <confdir>/conf
62     shift; _opt_config="$1"
63     ;;
64   --packages)          # Install packages defined in <confdir>/packages. Option arg:
65     shift; _opt_packages="$1"
66     _opt_packages_set=T
67     ;;
68   --debconf)           # Pre-seed packages using <confdir>/debconf-selections. Option
69     shift; _opt_debconf="$1"
70     _opt_debconf_set=T
71     ;;
72   --keep_src_list)     # Do not overwrite user provided apt sources.list.
73     _opt_keep_src_list=T
74     ;;
75   --hostname)          # Hostname of Debian system.
76     shift; _opt_hostname="$1"
77     ;;
78   --password)          # Use specified password as password for user root.
79     shift; _opt_password="$1"
80     ;;
81   #
82   --bootappend)        # Add specified appendline to kernel whilst booting.
83     shift; _opt_bootappend="$1"
84     ;;
85   --groot)             # Root device for usage in grub, corresponds with $TARGET in g
86     shift; _opt_groot="$1"
87     ;;
88   --grub)              # Target for grub installation. Use grub syntax for specifying
89     shift; _opt_grub="$1"
90     ;;
91
92   # == Other options
93   --help|-h)           # Print this usage information and exit.
94     _opt_help=T
95     ;;
96   --version|-v)        # Show summary of options and exit.
97     _opt_version=T
98     ;;
99   --)
100     shift; break
101     ;;
102   *)
103     eerror "Internal getopt error!"; eend 1 ; exit 1
104     ;;
105   esac
106   shift
107 done
108
109
110 # End