bootdisk: installer-validate (HEAD) [malekith]
PLD CVS
pld-cvs-commit w pld.org.pl
Pon, 29 Lip 2002, 13:13:28 CEST
Module name: bootdisk
Changes by: malekith 02/07/29 13:13:25
Modified files:
installer-validate
Log message:
- handle ftp://user:pass@foobar.com/ (might be important for net_proxy)
- check:
- net_proxy
- pkgs_cpus
- boot_loader_{device,other}
- insterted $(nls ...) in few places
Index: installer-validate
===================================================================
RCS file: /cvsroot/bootdisk/batch-installer/installer-validate,v
diff -d -u -r1.76 -r1.77
--- installer-validate 2002/06/26 12:56:27 1.76
+++ installer-validate 2002/07/29 11:13:25 1.77
@@ -296,10 +296,17 @@
if test "$dir" ; then
is_dirname $1 "$dir"
fi
- if echo $rest | grep -q ':' ; then
- host=`echo $rest | sed -e 's/:.*$//' || :`
- port=`echo $rest | sed -e 's/^[^:]*://' || :`
- fi
+
+ case $host in
+ *@* )
+ host=$(echo $host | sed -e 's/.*@//')
+ esac
+ case $host in
+ *:* )
+ port=$(echo $host | sed -e 's/.*://')
+ host=$(echo $host | sed -e 's/:[^:]*//')
+ esac
+
echo $port | grep -q '^[0-9]\+$' || error $1 "`nls "invalid port number: '%s'" "$port"`"
is_hostname $1 $host
@@ -390,7 +397,7 @@
is_not_empty net_device_module
is_not_list net_device_module
- # todo _options
+ # TODO: _options
is_not_list net_ipaddr
is_not_empty net_ipaddr
@@ -433,6 +440,18 @@
fi
have_net=yes
fi
+
+ if test "$net_proxy" -a "$net_proxy" != none ; then
+ check_url_hostname net_proxy
+ case $net_proxy in
+ http://* )
+ : ok
+ ;;
+ * )
+ error net_proxy "$(nls "should be http:// URL")"
+ ;;
+ esac
+ fi
}
# arg1=var_name arg2=string-to-check
@@ -505,7 +524,7 @@
eval_partition_info $id
- test "$dest_part_mnt_point" || break
+ test "$dest_part_device" || break
test "$dest_part_mnt_point" = "swap" || \
test "$dest_part_mnt_point" = "md" || \
@@ -565,7 +584,7 @@
echo $dest_part_size | grep -q '^[0-9]\+% of all$' || \
echo $dest_part_size | grep -q '^[0-9]\+% of free$' || \
echo $dest_part_size | grep -q '^[0-9]\+%[af]' || {
- error dest_part${id}_size "bad size"
+ error dest_part${id}_size "$(nls "bad size")"
}
if echo $dest_part_size | grep -q '%f'; then
@@ -599,6 +618,11 @@
error dest_part${id}_mnt_point "`nls "has to be 'md', for md partition"`"
fi
;;
+ vfat | msdos )
+ if [ "x$dest_part_format_partition" = "xyes" ] ; then
+ error dest_part${id}_format_partition "$(nls "can't format fat partitions")"
+ fi
+ ;;
*)
error dest_part${id}_filesystem "`nls "unsupported filesystem %s" "'$dest_part_filesystem'"`"
esac
@@ -649,8 +673,8 @@
check_pkgs () {
case "$pkgs_installer" in
poldek) : ;;
- wuch) error pkgs_installer "wuch not yet implemented, sorry!" ;;
- *) error pkgs_installer "`nls "only poldek and wuch supported now"`" ;;
+ wuch) error pkgs_installer "$(nls "wuch not implemented, sorry!")" ;;
+ *) error pkgs_installer "$(nls "only poldek supported now")" ;;
esac
case "$pkgs_install_docs" in
@@ -662,32 +686,74 @@
;;
esac
+ case "$pkgs_cpus" in
+ [0-9] | [0-9][0-9] | [0-9][0-9][0-9] | auto )
+ : ok
+ ;;
+ * )
+ error pkgs_cpus "$(nls 'should be number or auto')"
+ ;;
+ esac
+
if echo "$pkgs_install_langs" | \
grep -q '^\(\(all\)\|\(\([a-z][a-z]\(_[A-Z][A-Z]\)\?:\)*[a-z][a-z]\(_[A-Z][A-Z]\)\?\)\)$' ; then
: ok
else
error pkgs_install_langs \
- 'should be colon separated list of locales (like "pl_PL:en_US") or "all"'
+ "$(nls 'should be colon separated list of locales (like "%s") or "%s"' \
+ "pl:pl_PL:en:en_US" "all")"
fi
}
check_boot () {
-case "$boot_loader" in
+ case "$boot_loader" in
yaboot )
if [ "$arch" != ppc ] ; then
- error boot_loader "yaboot supported only on powerpc"
+ error boot_loader "$(nls "yaboot supported only on powerpc")"
fi
;;
lilo )
if [ "$arch" != ia32 ] ; then
- error boot_loader "lilo supported only on ia32"
+ error boot_loader "$(nls "lilo supported only on ia32")"
fi
;;
# rc-boot is also only supported on ia32, but this might change soon
rc-boot | none | "" ) : ;;
- grub) error boot_loader "select rc-boot to use grub";;
+ grub) error boot_loader "$(nls "select rc-boot to use grub")";;
*) error boot_loader "`nls "can be %s or empty" "'lilo', 'rc-boot', 'none'"`" ;;
-esac
+ esac
+
+ case "$boot_loader_device" in
+ auto )
+ : ok
+ ;;
+ * )
+ is_disk_or_part "$boot_loader_device" boot_loader_device
+ ;;
+ esac
+
+ for entry in $boot_loader_other ; do
+ eval $(parse_boot_loader_entry $entry)
+ case $img_os in
+ linux | bsd | dos )
+ : ok
+ ;;
+ * )
+ error boot_loader_other "$(nls "evil os")"
+ esac
+ is_disk_or_part "$img_root" boot_loader_other
+ if test "$img_kernel" ; then
+ is_dirname boot_loader_other "$img_kernel"
+ fi
+ if test "$img_initrd" ; then
+ is_dirname boot_loader_other "$img_initrd"
+ fi
+ if echo $img_label | grep -q '^[A-Za-z_][A-Za-z0-9_-]*$' ; then
+ : ok
+ else
+ error boot_loader_other "$(nls "evil label: '%s'" "$img_label")"
+ fi
+ done
}
check_pcmcia () {
Więcej informacji o liście dyskusyjnej pld-installer