mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-18 21:13:56 +01:00
integrate-distro.sh: Add support for --config-file and --non-interactive
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
0b3332cc56
commit
8ecffabb0a
1 changed files with 56 additions and 6 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
. ini-tools.sh
|
||||||
|
|
||||||
# -- defaults
|
# -- defaults
|
||||||
# install_dev=/dev/sdb
|
# install_dev=/dev/sdb
|
||||||
arch=`uname -m`
|
arch=`uname -m`
|
||||||
|
|
@ -440,12 +442,19 @@ usage()
|
||||||
|
|
||||||
get_opts()
|
get_opts()
|
||||||
{
|
{
|
||||||
eval set -- `getopt -o 'hd:n:a:p:k:u:w:s:r:f' -l parted-script: -- "$@"`
|
eval set -- `getopt -o 'hd:n:a:p:k:u:w:s:r:fc:' -l parted-script:,config-file:,non-interactive -- "$@"`
|
||||||
while [ "$1" != -- ] ; do
|
while [ "$1" != -- ] ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h)
|
-h)
|
||||||
usage 0
|
usage 0
|
||||||
;;
|
;;
|
||||||
|
-c|--config-file)
|
||||||
|
config_file="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--non-interactive)
|
||||||
|
non_interactive=1
|
||||||
|
;;
|
||||||
-d)
|
-d)
|
||||||
install_dev=$2
|
install_dev=$2
|
||||||
shift
|
shift
|
||||||
|
|
@ -557,6 +566,38 @@ check_var_set()
|
||||||
return $r
|
return $r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
have_cfg_file()
|
||||||
|
{
|
||||||
|
[ "$config_file" ] || return 1
|
||||||
|
[ -r "$config_file" ] || {
|
||||||
|
fatal "failed to read config file \"$config_file\""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
have_cfg_section()
|
||||||
|
{
|
||||||
|
have_cfg_file || return 1
|
||||||
|
ini_has_section "$config_file" "$@" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
have_cfg_value()
|
||||||
|
{
|
||||||
|
have_cfg_file || return 1
|
||||||
|
ini_has_value "$config_file" "$@" || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg_section()
|
||||||
|
{
|
||||||
|
have_cfg_file || return 1
|
||||||
|
ini_section "$config_file" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg_value()
|
||||||
|
{
|
||||||
|
have_cfg_file || return 1
|
||||||
|
ini_value "$config_file" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
_run_chroot()
|
_run_chroot()
|
||||||
{
|
{
|
||||||
local cmd
|
local cmd
|
||||||
|
|
@ -624,6 +665,10 @@ parted_script()
|
||||||
cat $parted_script
|
cat $parted_script
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
if have_cfg_section parted; then
|
||||||
|
ini_section "$config_file" parted
|
||||||
|
return
|
||||||
|
fi
|
||||||
default_parted_script
|
default_parted_script
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -811,7 +856,7 @@ make_etc_fstab_local_boot()
|
||||||
_cat<<EOT
|
_cat<<EOT
|
||||||
|$run_dev_swap swap swap defaults 0 0
|
|$run_dev_swap swap swap defaults 0 0
|
||||||
|$run_dev_root / ext4 acl,user_xattr 1 1
|
|$run_dev_root / ext4 acl,user_xattr 1 1
|
||||||
|$run_dev_boot /boot ext4 acl,user_xattr 1 2
|
|$run_dev_boot /boot ext3 acl,user_xattr 1 2
|
||||||
EOT
|
EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1340,6 +1385,15 @@ fi
|
||||||
|
|
||||||
[ ! "$scm_user" ] && scm_user=`whoami`
|
[ ! "$scm_user" ] && scm_user=`whoami`
|
||||||
|
|
||||||
|
case $cmd in
|
||||||
|
unmount)
|
||||||
|
unmount_devices
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# -- set up variables denoting devices
|
# -- set up variables denoting devices
|
||||||
|
|
||||||
if [ "$install_dev" ]; then
|
if [ "$install_dev" ]; then
|
||||||
|
|
@ -1400,10 +1454,6 @@ mount)
|
||||||
setup_bind_mounts
|
setup_bind_mounts
|
||||||
exit $?
|
exit $?
|
||||||
;;
|
;;
|
||||||
unmount)
|
|
||||||
unmount_devices
|
|
||||||
exit $?
|
|
||||||
;;
|
|
||||||
mkinitrd)
|
mkinitrd)
|
||||||
grub_boot_partition_num=0
|
grub_boot_partition_num=0
|
||||||
grub_slash_boot_partition_num=1
|
grub_slash_boot_partition_num=1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue