Support different versions of the same distribution

Split $DIST to distribution name and version (builder_setup script) and search
for scripts first $DIST-specific, but then for given distribution.

Also move out some Fedora-specific things to scripts_fc17.
pull/1/head
Marek Marczykowski 11 years ago
parent 746cb149c9
commit add64aa2e4

@ -2,6 +2,7 @@ ifndef DIST
$(error "You must set DIST variable, e.g. DIST=fc14")
endif
#TODO: build template name somehow smarter
TEMPLATE_NAME := $${DIST/fc/fedora-}-x64
VERSION := $(shell cat version)
TIMESTAMP := $(shell date -u +%Y%m%d%H%M)
@ -15,9 +16,8 @@ help:
rpms:
@echo $(TIMESTAMP) > build_timestamp
@echo "Building template: $(TEMPLATE_NAME)"
@createrepo -q -g $$PWD/comps-qubes-template.xml yum_repo_qubes/$(DIST) -o yum_repo_qubes/$(DIST) && \
sudo -E ./fedorize_image fedorized_images/$(TEMPLATE_NAME).img && \
sudo -E ./qubeize_image fedorized_images/$(TEMPLATE_NAME).img $(TEMPLATE_NAME) && \
sudo -E ./prepare_image prepared_images/$(TEMPLATE_NAME).img && \
sudo -E ./qubeize_image prepared_images/$(TEMPLATE_NAME).img $(TEMPLATE_NAME) && \
./build_template_rpm $(TEMPLATE_NAME) || exit 1; \
update-repo-installer:

@ -6,9 +6,13 @@ echo "usage $0 <template_name>"
exit 1
fi
. ./builder_setup
rpmbuild --target noarch \
--define "template_name $NAME" \
--define "DIST $DIST" \
--define "DISTRIBUTION $DISTRIBUTION" \
--define "VERSION $VERSION" \
--define "_topdir $PWD/rpmbuild" \
--define "_tmppath $PWD/rpmbuild/tmp" \
-bb templates.spec

@ -0,0 +1,22 @@
#!/bin/bash
# Setup env variables
case "$DIST" in
fc*)
DISTRIBUTION=fedora
VERSION=${DIST/fc/}
;;
*)
DISTRIBUTION="$DIST"
VERSION=
;;
esac
if [ -d "scripts_$DIST" ]; then
SCRIPTSDIR="scripts_$DIST"
else
SCRIPTSDIR="scripts_$DISTRIBUTION"
fi
export SCRIPTSDIR

@ -2,6 +2,8 @@
export IMG=$1
. ./builder_setup
set -e
if ! [ $# -eq 1 ]; then
@ -18,7 +20,7 @@ ls -als $IMG
mount -o loop $IMG mnt || exit 1
export INSTALLDIR=`pwd`/mnt/
scripts_"${DIST}"/09_cleanup.sh
$SCRIPTSDIR/09_cleanup.sh
echo "--> Compacting image file..."
dd if=/dev/zero of=mnt/fillme bs=1M > /dev/null 2>&1 || true

@ -6,6 +6,8 @@ RETCODE=0
: ${DIST=fc14}
. ./builder_setup
if ! [ $# -eq 1 ]; then
echo "usage $0 <img_file_name>"
exit
@ -15,15 +17,15 @@ if [ "$VERBOSE" == "1" ]; then
export YUM_OPTS="$YUM_OPTS -q"
fi
echo "-> Preparing instalation of $DIST template..."
$SCRIPTSDIR/00_prepare.sh
if [ -f $IMG ]; then
echo "-> Image file already exists, assuming *update*..."
mount -o loop $IMG mnt || exit 1
export INSTALLDIR=`pwd`/mnt/
else
echo "-> Preparing instalation of $DIST template..."
scripts_"${DIST}"/00_prepare.sh
echo "-> Initializing empty image..."
truncate -s 10G $IMG || exit 1
@ -35,14 +37,11 @@ else
export INSTALLDIR=`pwd`/mnt/
scripts_"${DIST}"/01_install_core.sh
$SCRIPTSDIR/01_install_core.sh
fi
PKGLISTFILE=$(shell [ -r scripts_"${DIST}/packages_$(DIST).list" ] && echo scripts_"${DIST}/packages_$(DIST).list" || echo scripts_"${DIST}/packages.list")
export PKGGROUPS=$(cat $PKGLISTFILE)
echo "-> Installing package groups..."
scripts_"${DIST}"/02_install_groups.sh
$SCRIPTSDIR/02_install_groups.sh
echo "-> Unmounting fedorized_image..."
sudo umount $INSTALLDIR

@ -3,6 +3,8 @@
export CLEANIMG=$1
export NAME=$2
. ./builder_setup
set -e
if [ $# -eq 0 ]; then
@ -50,7 +52,7 @@ mkdir -p mnt
mount -o loop $IMG mnt || exit 1
export INSTALLDIR=mnt
scripts_"${DIST}"/04_install_qubes.sh
$SCRIPTSDIR/04_install_qubes.sh
echo "--> Copying the Apps Menu shortcuts..."
export APPSORIG=qubeized_images/$NAME-apps.orig

@ -3,6 +3,8 @@
echo "Mounting archlinux install system into archlinux_dvd..."
sudo mount root-image.fs archlinux_dvd
PKGGROUPS=`cat $SCRIPTSDIR/packages.list`
echo "-> Installing archlinux package groups..."
echo "-> Selected packages:"
echo "$PKGGROUPS"

@ -3,3 +3,5 @@
rm -f keys base_rpms
ln -sf keys_$DIST keys
ln -sf base_rpms_$DIST base_rpms
createrepo -q -g $PWD/comps-qubes-template.xml yum_repo_qubes/$DIST -o yum_repo_qubes/$DIST

@ -2,6 +2,13 @@
echo "--> Preparing environment..."
mount -t proc proc mnt/proc
if [ -r "$SCRIPTSDIR/packages_${DIST}.list" ]; then
PKGLISTFILE="$SCRIPTSDIR/packages_${DIST}.list"
else
PKGLISTFILE="$SCRIPTSDIR/packages.list"
fi
export PKGGROUPS=$(cat $PKGLISTFILE)
export YUM0=$PWD/yum_repo_qubes
yum clean all -c $PWD/yum.conf $YUM_OPTS -y --installroot=$PWD/mnt
yum install -c $PWD/yum.conf $YUM_OPTS -y --installroot=$INSTALLDIR $PKGGROUPS || RETCODE=1

@ -45,7 +45,7 @@ touch $RPM_BUILD_ROOT/%{dest_dir}/root.img # we will create the real file in %po
touch $RPM_BUILD_ROOT/%{dest_dir}/private.img # we will create the real file in %post
touch $RPM_BUILD_ROOT/%{dest_dir}/volatile.img # we will create the real file in %post
cp scripts_%{DIST}/clean-volatile.img.tar $RPM_BUILD_ROOT/%{dest_dir}/clean-volatile.img.tar
cp $SCRIPTSDIR/clean-volatile.img.tar $RPM_BUILD_ROOT/%{dest_dir}/clean-volatile.img.tar
mkdir -p $RPM_BUILD_ROOT/%{dest_dir}/apps.templates
mkdir -p $RPM_BUILD_ROOT/%{dest_dir}/apps

Loading…
Cancel
Save