r4506 - dists/trunk/utils/initramfs-tools
Jonas Smedegaard
js at costa.debian.org
Mon Oct 17 08:59:34 UTC 2005
Author: js
Date: 2005-10-17 08:59:34 +0000 (Mon, 17 Oct 2005)
New Revision: 4506
Modified:
dists/trunk/utils/initramfs-tools/mkinitramfs
Log:
Use GNU getopt (instead of bash builtin getopts) for improved long-opts handling.
Modified: dists/trunk/utils/initramfs-tools/mkinitramfs
===================================================================
--- dists/trunk/utils/initramfs-tools/mkinitramfs 2005-10-17 08:40:19 UTC (rev 4505)
+++ dists/trunk/utils/initramfs-tools/mkinitramfs 2005-10-17 08:59:34 UTC (rev 4506)
@@ -10,37 +10,47 @@
# BUSYBOXDIR="/usr/lib/initramfs-tools/bin/"
BUSYBOXDIR="/bin"
-while getopts "d:ko:r:-:" flag; do
- case $flag in
- d)
- CONFDIR="${OPTAGS}"
+TEMP=`getopt -o d:ko:r: --long supported-host-version:,supported-target-version: -n "$0" -- "$@"`
+
+# Check for non-GNU getopt
+if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
+
+eval set -- "$TEMP"
+
+while true ; do
+ case "$1" in
+ -d)
+ CONFDIR="$2"
+ shift 2
if [ ! d "${CONFDIR}" ]; then
echo "${0}: ${CONFDIR}: Not a directory" >&2
exit 1
fi
;;
- o)
- touch ${OPTARG}
- outfile="$(readlink -f ${OPTARG})"
+ -o)
+ touch $2
+ shift 2
+ outfile="$(readlink -f $2)"
;;
- k)
+ -k)
keep="y"
+ shift
;;
- -)
- case ${OPTARG%=*} in
- supported-host-version)
- supported_host_version=${OPTARG#*=}
- ;;
- supported-target-version)
- supported_target_version=${OPTARG#*=}
- ;;
- esac
+ --supported-host-version)
+ supported_host_version="$2"
+ shift 2
;;
+ --supported-target-version)
+ supported_target_version="$2"
+ shift 2
+ ;;
+ --)
+ shift
+ break
+ ;;
esac
done
-shift $((${OPTIND} - 1))
-
if [ "$supported_host_version" ] || [ "$supported_target_version" ]; then
if [ "$supported_host_version" ]; then
host_upstream_version=${supported_host_version%%-*}
More information about the Kernel-svn-changes
mailing list