Various tweaks for myplc-native (not thoroughly tested yet) :
[myplc.git] / build.functions
index 895dcc4..a96e295 100644 (file)
@@ -46,37 +46,15 @@ set -e
 # Be verbose
 set -x
 
-# Make a basic chroot at the specified location given the specified
-# configuration.
-make_chroot_from_lst() {
-    root=$1; shift
-    fcdistro=$1; shift
-
-    packages=$(pl_getPackagesOptions2 $fcdistro $lst"$@")
-    groups=$(pl_getGroupsOptions2 $fcdistro "$@") 
-
-    pl_setup_chroot $root $packages $groups
-}
-
-# Move specified directories out of the chroot and into a "data"
-# directory that will be bind mounted on /data inside the chroot.
-#move_datadirs() {
-#    root=$1
-#    data=$2
-#    shift 2
-#    pl_move_dirs $root $data /data "$@"
-#}
-
-# Make loopback filesystem from specified location
-#make_image() {
-#    root=$1
-#    image=$2
-#    pl_make_image $root $image 100000000
-#}
+# this is fragile, as the actual layout may vary from one mirror to the other
+# however this should be in line with the layouts obtained 
+# when running build/vbuild-fedora-mirror.sh
 
 function yum_conf_to_build_host () {
-   BUILD_HOST=$(hostname)
-   cat <<EOF
+    build_dir=$1; shift
+    BUILD_HOST=$(hostname)
+
+    cat <<EOF
 [main]
 cachedir=/var/cache/yum
 debuglevel=2
@@ -92,73 +70,13 @@ gpgcheck=0
 # (e.g., from /etc/yum.repos.d/)
 reposdir=/dev/null
 
-[base]
-name=Fedora Core 4 - i386 - base
-baseurl=http://${BUILD_HOST}/fedora/linux/core/${pl_DISTRO_RELEASE}/${pl_DISTRO_ARCH}/os/
-
-
-[updates]
-name=Fedora Core 4 - i386 - updates
-baseurl=http://${BUILD_HOST}/fedora/linux/core/updates/${pl_DISTRO_RELEASE}/${pl_DISTRO_ARCH}/
-
-$(if [ "${pl_DISTRO_RELEASE}" -le 6 ] ; then cat << EXTRAS
-[extras]
-name=Fedora Core 4 - i386 - extras
-baseurl=http://${BUILD_HOST}/fedora/linux/extras/${pl_DISTRO_RELEASE}/${pl_DISTRO_ARCH}/
-EXTRAS
-fi)
 EOF
 
-}
-
-function sudoers_bootcustom_apache () {
-    cat <<EOF
-User_Alias WWW = %apache,%root
-Cmnd_Alias BOOTCUSTOM = /usr/share/bootcd/bootcustom.sh
-WWW          ALL = NOPASSWD: BOOTCUSTOM 
-EOF
-}
-
-# quick and dirty - might break anytime if docbook html output changes
-function docbook_html_to_drupal () {
-    title=$1; shift
-    html=$1; shift
-    php=$1; shift
-
-    mkdir -p $(dirname $php)
-    if [ ! -f $html ] ; then
-       cat << __header_no_doc__ > $php
-<?php
-require_once 'plc_drupal.php';
-drupal_set_title("$title - unavailable");
-?>
-<p class='plc-warning'> Build-time error - could not locate documentation $html</p>
-__header_no_doc__
+    template=$build_dir/mirroring/${pl_DISTRO_NAME}/yum.repos.d/building.repo.in
+    if [ ! -f $template ] ; then
+       echo "# MyPLC/$0: cannot find template $template"
     else
-       # insert header, makes sure we have a trailing eol
-       (cat << __header_doc__ ; cat $html ) > $php
-<?php
-require_once 'plc_drupal.php';
-drupal_set_title("$title");
-?>
-__header_doc__
-       # ignore ed return status
-       set +e
-       # cuts off around the <body> </body>
-       # preserves the 4 first lines that we just added as a header
-       ed -s $php << __ed_script__
-/BODY/
-/>/
-s,><,<,
-5,-d
-$
-?/BODY?
-s,><.*,>,
-+
-;d
-w
-q
-__ed_script__
-       set -e
+       sed -e s,@MIRRORURL@,http://${BUILD_HOST}/mirror/, $template
     fi
-}   
+}
+