mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-23 14:30:39 +01:00
integrate-distro.sh: Make repositories configurable
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
8ecffabb0a
commit
a56eb97d4a
1 changed files with 77 additions and 61 deletions
|
|
@ -327,8 +327,6 @@ special_pkgs="
|
||||||
kernel$kernel_flavour-$rpm_kernel_version
|
kernel$kernel_flavour-$rpm_kernel_version
|
||||||
rpm
|
rpm
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
# -- sysvinit
|
# -- sysvinit
|
||||||
# systemd-sysvinit boots, but doesn't work cleanly as of now
|
# systemd-sysvinit boots, but doesn't work cleanly as of now
|
||||||
|
|
||||||
|
|
@ -413,7 +411,7 @@ usage()
|
||||||
echo "
|
echo "
|
||||||
|
|
||||||
usage: $myname -h
|
usage: $myname -h
|
||||||
$myname [options] [install|mount|unmount|mkinitrd|fs|parted-script|root-dir]
|
$myname [options] [install|mount|unmount|mkinitrd|fs|default-config|root-dir]
|
||||||
|
|
||||||
options:
|
options:
|
||||||
-f
|
-f
|
||||||
|
|
@ -442,7 +440,7 @@ usage()
|
||||||
|
|
||||||
get_opts()
|
get_opts()
|
||||||
{
|
{
|
||||||
eval set -- `getopt -o 'hd:n:a:p:k:u:w:s:r:fc:' -l parted-script:,config-file:,non-interactive -- "$@"`
|
eval set -- `getopt -o 'hd:n:a:p:k:u:w:s:r:fc:' -l config-file:,non-interactive -- "$@"`
|
||||||
while [ "$1" != -- ] ; do
|
while [ "$1" != -- ] ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h)
|
-h)
|
||||||
|
|
@ -495,10 +493,6 @@ get_opts()
|
||||||
-f)
|
-f)
|
||||||
o_force=1
|
o_force=1
|
||||||
;;
|
;;
|
||||||
--parted-script)
|
|
||||||
parted_script="$2"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
usage 1
|
usage 1
|
||||||
;;
|
;;
|
||||||
|
|
@ -574,30 +568,89 @@ have_cfg_file()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
have_cfg_section()
|
cfg_default()
|
||||||
|
{
|
||||||
|
cat <<-EOT | grep -v "^ *#"
|
||||||
|
[parted]
|
||||||
|
mklabel gpt
|
||||||
|
mkpart primary 1M 2M
|
||||||
|
name 1 grub
|
||||||
|
set 1 bios_grub
|
||||||
|
mkpart primary 2M 10G
|
||||||
|
name 2 boot
|
||||||
|
mkpart primary 10G 40G
|
||||||
|
name 3 swap
|
||||||
|
mkpart primary 40G $max
|
||||||
|
name 4 root
|
||||||
|
|
||||||
|
[repos.base]
|
||||||
|
distro-oss 0 ftp://ftp/pub/mirror/suse/distribution/$suse_version/repo/oss
|
||||||
|
|
||||||
|
[repos.update]
|
||||||
|
#distro-non-oss 0 ftp://ftp/pub/mirror/suse/distribution/$suse_version/repo/non-oss
|
||||||
|
#update 0 ftp://ftp/pub/mirror/suse/update/$suse_version
|
||||||
|
|
||||||
|
[repos.payload]
|
||||||
|
#ftp.jannet.de 10 ftp://dspdev:123qweasd@ftp.jannet.de/pub/packages/linux/suse/$suse_version/inst-source
|
||||||
|
ftp.jannet.de 10 ftp://dspdev:123qweasd@ftp/pub/mirror/jannet/ftp/pub/packages/linux/suse/$suse_version/inst-source
|
||||||
|
ftp.priv.lcl 5 ftp://dspdev:123qweasd@ftp.priv.lcl/pub/local/packages/suse/$suse_version
|
||||||
|
|
||||||
|
[repos.special]
|
||||||
|
#jengelh 0 ftp://ftp/pub/mirror/gwdg/pub/linux/misc/suser-jengelh/openSUSE_$suse_version
|
||||||
|
#videolan 0 ftp://ftp/pub/mirror/videolan/pub/videolan/vlc/SuSE/$suse_version
|
||||||
|
EOT
|
||||||
|
}
|
||||||
|
|
||||||
|
have_cfg_file_section()
|
||||||
{
|
{
|
||||||
have_cfg_file || return 1
|
have_cfg_file || return 1
|
||||||
ini_has_section "$config_file" "$@" || return 1
|
ini_has_section "$config_file" "$@" || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
have_cfg_value()
|
have_cfg_file_value()
|
||||||
{
|
{
|
||||||
have_cfg_file || return 1
|
have_cfg_file || return 1
|
||||||
ini_has_value "$config_file" "$@" || return 1
|
ini_has_value "$config_file" "$@" || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg_section()
|
cfg_file_section()
|
||||||
{
|
{
|
||||||
have_cfg_file || return 1
|
have_cfg_file || return 1
|
||||||
ini_section "$config_file" "$@"
|
ini_section "$config_file" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg_value()
|
cfg_file_value()
|
||||||
{
|
{
|
||||||
have_cfg_file || return 1
|
have_cfg_file || return 1
|
||||||
ini_value "$config_file" "$@"
|
ini_value "$config_file" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg_section()
|
||||||
|
{
|
||||||
|
if have_cfg_file_section "$1"; then
|
||||||
|
cfg_file_section "$1"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
if cfg_default | ini_has_section /dev/stdin "$1"; then
|
||||||
|
cfg_default | ini_section /dev/stdin "$1"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg_value()
|
||||||
|
{
|
||||||
|
if have_cfg_file_value "$1"; then
|
||||||
|
cfg_file_value "$1"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
if cfg_default | ini_has_value /dev/stdin "$1"; then
|
||||||
|
cfg_default | ini_value /dev/stdin "$1"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
_run_chroot()
|
_run_chroot()
|
||||||
{
|
{
|
||||||
local cmd
|
local cmd
|
||||||
|
|
@ -643,41 +696,12 @@ run_parted()
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
default_parted_script()
|
|
||||||
{
|
|
||||||
cat <<- EOT
|
|
||||||
mklabel gpt
|
|
||||||
mkpart primary 1M 2M
|
|
||||||
name 1 grub
|
|
||||||
set 1 bios_grub
|
|
||||||
mkpart primary 2M 10G
|
|
||||||
name 2 boot
|
|
||||||
mkpart primary 10G 40G
|
|
||||||
name 3 swap
|
|
||||||
mkpart primary 40G $max
|
|
||||||
name 4 root
|
|
||||||
EOT
|
|
||||||
}
|
|
||||||
|
|
||||||
parted_script()
|
|
||||||
{
|
|
||||||
if [ "$parted_script" ]; then
|
|
||||||
cat $parted_script
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if have_cfg_section parted; then
|
|
||||||
ini_section "$config_file" parted
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
default_parted_script
|
|
||||||
}
|
|
||||||
|
|
||||||
create_partition_table()
|
create_partition_table()
|
||||||
{
|
{
|
||||||
assert_not_mounted
|
assert_not_mounted
|
||||||
local max=$(LANG=POSIX parted -s $install_dev print | sed '/Disk/ !d; s/.*: *//')
|
local max=$(LANG=POSIX parted -s $install_dev print | sed '/Disk/ !d; s/.*: *//')
|
||||||
|
|
||||||
parted_script | run_parted
|
cfg_section parted | run_parted
|
||||||
grub_boot_partition_num=0
|
grub_boot_partition_num=0
|
||||||
grub_slash_boot_partition_num=1
|
grub_slash_boot_partition_num=1
|
||||||
}
|
}
|
||||||
|
|
@ -765,45 +789,36 @@ unmount_devices()
|
||||||
rm -f $ssh_auth_sock
|
rm -f $ssh_auth_sock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO: remove this >
|
||||||
zypper_repos_base()
|
zypper_repos_base()
|
||||||
{
|
{
|
||||||
_cat << EOT | grep -v " #"
|
cfg_section repos.base
|
||||||
|distro-oss 0 ftp://ftp/pub/mirror/suse/distribution/$suse_version/repo/oss
|
|
||||||
EOT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zypper_repos_update()
|
zypper_repos_update()
|
||||||
{
|
{
|
||||||
# need to do this, as empty list breaks for loop in setup_zypper_repos()
|
# need to do this, as empty list breaks for loop in setup_zypper_repos()
|
||||||
return 0
|
return 0
|
||||||
cat <<- EOT | grep -v "^ *#"
|
cfg_section repos.update
|
||||||
#distro-non-oss 0 ftp://ftp/pub/mirror/suse/distribution/$suse_version/repo/non-oss
|
|
||||||
#update 0 ftp://ftp/pub/mirror/suse/update/$suse_version
|
|
||||||
EOT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zypper_repos_payload()
|
zypper_repos_payload()
|
||||||
{
|
{
|
||||||
cat <<- EOT | grep -v "^ *#"
|
cfg_section repos.payload
|
||||||
#ftp.jannet.de 10 ftp://dspdev:123qweasd@ftp.jannet.de/pub/packages/linux/suse/$suse_version/inst-source
|
|
||||||
ftp.jannet.de 10 ftp://dspdev:123qweasd@ftp/pub/mirror/jannet/ftp/pub/packages/linux/suse/$suse_version/inst-source
|
|
||||||
ftp.priv.lcl 5 ftp://dspdev:123qweasd@ftp.priv.lcl/pub/local/packages/suse/$suse_version
|
|
||||||
EOT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zypper_repos_special()
|
zypper_repos_special()
|
||||||
{
|
{
|
||||||
return 0
|
return 0
|
||||||
cat <<- EOT | grep -v "^ *#"
|
cfg_section repos.special
|
||||||
#jengelh 0 ftp://ftp/pub/mirror/gwdg/pub/linux/misc/suser-jengelh/openSUSE_$suse_version
|
|
||||||
#videolan 0 ftp://ftp/pub/mirror/videolan/pub/videolan/vlc/SuSE/$suse_version
|
|
||||||
EOT
|
|
||||||
}
|
}
|
||||||
|
# TODO: remove this <
|
||||||
|
|
||||||
zypper_repos()
|
zypper_repos()
|
||||||
{
|
{
|
||||||
local repo cmd
|
local repo cmd
|
||||||
for repo in $*; do
|
for repo in $*; do
|
||||||
|
#cfg_section repos.$repo # hangs
|
||||||
zypper_repos_$repo
|
zypper_repos_$repo
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
@ -1353,8 +1368,9 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $cmd in
|
case $cmd in
|
||||||
parted-script)
|
default-config)
|
||||||
parted_script
|
cfg_default
|
||||||
|
exit $?
|
||||||
;;
|
;;
|
||||||
root-dir)
|
root-dir)
|
||||||
echo $root
|
echo $root
|
||||||
|
|
@ -1376,7 +1392,7 @@ if [ `whoami` != root -o "$l32" ]; then
|
||||||
#sudo -i $exe $@ -p $root_password_file
|
#sudo -i $exe $@ -p $root_password_file
|
||||||
[ "$env_ssh_auth_sock" ] && opt_ssh_auth_sock="-s $env_ssh_auth_sock"
|
[ "$env_ssh_auth_sock" ] && opt_ssh_auth_sock="-s $env_ssh_auth_sock"
|
||||||
opts=""
|
opts=""
|
||||||
[ "$parted_script" ] && opts="$opts --parted-script $parted_script"
|
[ "$config_file" ] && opts="$opts --config-file $config_file"
|
||||||
#debug="/bin/bash -x"
|
#debug="/bin/bash -x"
|
||||||
ssh -l root localhost $l32 $debug $exe $@ -p $root_password_file -u $scm_user -w $cwd $opt_ssh_auth_sock $opts
|
ssh -l root localhost $l32 $debug $exe $@ -p $root_password_file -u $scm_user -w $cwd $opt_ssh_auth_sock $opts
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue