X-Git-Url: https://git.tld-linux.org/?p=TLD.git;a=blobdiff_plain;f=pld-builder.new%2Fadmin%2Finstall-chroot.sh;fp=pld-builder.new%2Fadmin%2Finstall-chroot.sh;h=937b877a6da6682403dcc2db5651328f8434cf21;hp=0000000000000000000000000000000000000000;hb=90809c8fec988489786ce00247d9a4150070748b;hpb=ab3934fab858112cd552359b18cb980ea07c310b diff --git a/pld-builder.new/admin/install-chroot.sh b/pld-builder.new/admin/install-chroot.sh new file mode 100755 index 0000000..937b877 --- /dev/null +++ b/pld-builder.new/admin/install-chroot.sh @@ -0,0 +1,218 @@ +#!/bin/sh + +DIST="th" +DISTTAG="PLD 3.0 (Th)" + +die () { + echo "$0: $*" 1>&2 + cat 1>&2 </ (required in src builder) + git_user= (required in src builder) + builder_uid=2000 (optional, uid of builder user + in chroot; defaults to current uid) +EOF + exit 1 +} + +default_config () { + builder_pkgs="rpm-build poldek pwdutils net-tools which rpm-perlprov rpm-php-pearprov rpm-pythonprov bash vim" + builder_uid=`id -u` + dist_url="ftp://ftp.$DIST.pld-linux.org" + + case "$chroot_type" in + src ) + builder_arch_pkgs="wget gawk git-core" + ;; + bin ) + builder_arch_pkgs="mount" + ;; + esac +} + +check_conf () { + test "$chroot_dir" || die "no chroot_dir" + test "$arch" || die "no arch" + test "$dist_url" || die "no dist_url" + + case "$chroot_type" in + src ) + test "$git_server" || die "no git_server" + test "$git_user" || die "no git_user" + ;; + bin ) + ;; + * ) + die "evil chroot_type: $chroot_type" + ;; + esac +} + +poldek_src () { + if test "$1" ; then + cat <install-specs <~/.rpmmacros +echo "%vendor PLD">>~/.rpmmacros +echo "%distribution $DISTTAG">>~/.rpmmacros +git config --global user.name $git_user +git config --global user.email ${git_user}@pld-linux.org +EOF + chb "sh" < install-specs + rm install-specs + echo "WARNING: Do not forget to install ssh keys to access git repo" +} + +install_build_tree () { + cat >install-bt <~/.rpmmacros +echo "%vendor PLD">>~/.rpmmacros +echo "%distribution $DISTTAG">>~/.rpmmacros +EOF + chb "sh" < install-bt + rm install-bt +} + + + + +eval "$*" || usage +default_config +eval "$*" +check_conf + +rm -rf tmp-chroot +mkdir tmp-chroot +cd tmp-chroot + +cat >poldek.conf < install-$chroot_name.sh <poldek.conf < /etc/resolv.conf" < /etc/resolv.conf +chr "cat > /etc/mtab" < /dev/null +chr "mkdir -p /spools/ready/" < /dev/null +chr "mkdir -p /spools/poldek/" < /dev/null +chr "sed -e 's,^\(root:.*\)/bin/sh$,\1/bin/bash,' -i~ /etc/passwd" + + +case $chroot_type in + src ) + install_SPECS_builder + ;; + bin ) + install_build_tree + ;; +esac