Compare commits

...

15 Commits
R4.0 ... master

Author SHA1 Message Date
587c7bae95
TAILORED: build 4k sector sized templates only
https://github.com/QubesOS/qubes-issues/issues/4974#issuecomment-575955927
2020-02-02 19:08:15 +01:00
Marek Marczykowski-Górecki
3a04f2adaf
rpm: make old root.img unlink explicit
Co-authored-by: ttasket <tasket@openmailbox.org>
Closes #1
2018-12-02 16:42:48 +01:00
fepitre
8b6f0e0e1f
appmenus: handle multiple releases common menus 2018-09-02 00:47:54 +02:00
Marek Marczykowski-Górecki
0a77671d21
Merge remote-tracking branch 'qubesos/pr/12'
* qubesos/pr/12:
  bind mount /usr/local
2018-07-11 15:48:47 +02:00
Reynir Björnsson
fd2c693ca8
bind mount /usr/local 2018-07-11 11:15:25 +02:00
Marek Marczykowski-Górecki
d8ccdfc8f0
version 4.0.1 2018-07-03 05:53:58 +02:00
Marek Marczykowski-Górecki
6cbac4b4e0
Rename TIMESTAMP variable to TEMPLATE_TIMESTAMP
Make it explicit that it's about template. Allow setting it from the
outside, to make predictable template version.

QubesOS/qubes-issues#3935
2018-06-28 13:58:54 +02:00
Marek Marczykowski-Górecki
1c7006b829
Mark phony targets 2018-06-28 13:58:26 +02:00
Marek Marczykowski-Górecki
47ea5b90ea
Fix handling TEMPLATE_LABEL when calculating template name
Yet another case of make not passing exported variables to $(shell ...)
(https://savannah.gnu.org/bugs/?10593). Here it applies when
builder.conf was loaded in the same make instance - make
--eval='include builder.conf' call from check-release-status script.

QubesOS/qubes-issues#3935
2018-06-28 13:53:09 +02:00
Marek Marczykowski-Górecki
6dbed7ec3b
Use full path to mkfs.ext4
On some systems (Debian, OpenSUSE) /sbin isn't in PATH for normal users.
2018-06-13 20:53:53 +02:00
Marek Marczykowski-Górecki
a78fc2ddbb
Pretend the template rpm is build the standard way
This allows to reuse standard update-repo-* and sign-* make targets.

QubesOS/qubes-issues#3935
2018-06-04 02:19:32 +02:00
Marek Marczykowski-Górecki
ee42db95ec
fix functions-name.sh 2018-06-04 02:18:34 +02:00
Marek Marczykowski-Górecki
0a8e29571f
Add 'sign' target
This will ease signing just one template, instead of checking all of
them for the unsigned one(s).
2018-05-25 16:31:23 +02:00
Marek Marczykowski-Górecki
310019ea3c
Remove raw root.img after packaging it into rpm - if DISCARD_PREPARED_IMAGE is set 2018-05-24 04:03:47 +02:00
Frédéric Pierret
75ca54bea6
Add support for defining QubesOS repository mirror 2018-05-06 12:04:19 +02:00
9 changed files with 60 additions and 20 deletions

View File

@ -20,10 +20,12 @@ TEMPLATE_ENV_WHITELIST += \
TEMPLATE_ROOT_WITH_PARTITIONS TEMPLATE_ROOT_SIZE \
USE_QUBES_REPO_VERSION USE_QUBES_REPO_TESTING \
BUILDER_TURBO_MODE REPO_PROXY FEDORA_MIRROR \
CENTOS_MIRROR EPEL_MIRROR
CENTOS_MIRROR EPEL_MIRROR QUBES_MIRROR
# Make sure names are < 32 characters, process aliases
fix_up := $(shell TEMPLATE_NAME=$(TEMPLATE_NAME) ./builder_fix_filenames)
fix_up := $(shell TEMPLATE_NAME=$(TEMPLATE_NAME) \
TEMPLATE_LABEL="$(TEMPLATE_LABEL)" \
./builder_fix_filenames)
TEMPLATE_NAME := $(word 1,$(fix_up))
export TEMPLATE_NAME
@ -31,7 +33,10 @@ export TEMPLATE_SCRIPTS
export DISTRIBUTION
VERSION := $(shell cat version)
TIMESTAMP := $(shell date -u +%Y%m%d%H%M)
TEMPLATE_TIMESTAMP ?= $(shell date -u +%Y%m%d%H%M)
.PHONY: help template-name prepare package rpms rootimg-build
.PHONY: update-repo-templates-itl update-repo-templates-community
help:
@echo "make rpms -- generate template rpm"
@ -43,7 +48,7 @@ template-name:
prepare:
@echo "Building template: $(TEMPLATE_NAME)"
@echo $(TIMESTAMP) > build_timestamp_$(TEMPLATE_NAME)
@echo $(TEMPLATE_TIMESTAMP) > build_timestamp_$(TEMPLATE_NAME)
package:
./build_template_rpm $(TEMPLATE_NAME)
@ -72,6 +77,9 @@ update-repo-installer:
[ -z "$$UPDATE_REPO" ] && UPDATE_REPO=../installer/yum/qubes-dom0;\
ln -f rpm/noarch/qubes-template-$(TEMPLATE_NAME)-$(VERSION)-$(shell cat build_timestamp_$(TEMPLATE_NAME))*.noarch.rpm $$UPDATE_REPO/rpm
sign:
setsid -w rpmsign $$RPMSIGN_OPTS --addsign rpm/noarch/qubes-template-$(TEMPLATE_NAME)-$(VERSION)-$(shell cat build_timestamp_$(TEMPLATE_NAME))*.noarch.rpm
prepare-repo-template:
rm -rf pkgs-for-template/$(DIST)
mkdir -p pkgs-for-template/$(DIST)

5
Makefile.builder Normal file
View File

@ -0,0 +1,5 @@
# pretend that normal package is built from this repo, to reuse update-repo-*
ifeq ($(PACKAGE_SET),vm)
OUTPUT_DIR = rpm
RPM_SPEC_FILES = templates.spec
endif

View File

@ -26,3 +26,7 @@ rpmbuild --target noarch \
--define "_topdir $PWD/rpmbuild" \
--define "_tmppath $PWD/rpmbuild/tmp" \
-bb templates.spec
if [ "0$DISCARD_PREPARED_IMAGE" -eq "1" ]; then
rm -rf "qubeized_images/$NAME"
fi

View File

@ -71,7 +71,7 @@ templateNameDist() {
template_name="$(templateName)" && dist_name="${template_name}"
# Automaticly correct name length if it's greater than 32 chars
dist_name="$(templateNameFixLength ${template_name})"
dist_name="$(templateNameFixLength ${dist_name})"
# Remove and '+' characters from name since they are invalid for name
dist_name="${dist_name//+/-}"
@ -79,7 +79,7 @@ templateNameDist() {
}
templateName() {
local template_flavor=${1-${TEMPLATE_FLAVOR}}
local template_flavor=${1:-${TEMPLATE_FLAVOR}}
retval=1 # Default is 1; mean no replace happened
# Only apply options if $1 was not passed

View File

@ -18,7 +18,7 @@ mkdir -p mnt
MNTDIR=$(pwd)/mnt
LOOP=$(/sbin/losetup -f --show -o $OFFSET $ROOTIMG)
LOOP=$(/sbin/losetup -b 4096 -f --show -o $OFFSET $ROOTIMG)
if [ x$LOOP = x ] ; then
echo "Cannot setup loopback device for the $ROOTIMG file -- perhaps a permissions problem?"

View File

@ -50,10 +50,13 @@ echo "-> Preparing instalation of ${DIST} template..."
if [ -f "${IMG}" ]; then
echo "-> Image file already exists, assuming *update*..."
if [ "0$TEMPLATE_ROOT_WITH_PARTITIONS" -eq 1 ]; then
IMG_LOOP=$(/sbin/losetup -P -f --show "$IMG")
IMG_LOOP=$(/sbin/losetup -b 4096 -P -f --show "$IMG")
# BUG: losetup's partscan (-P) does nothing when trying 4096 sectors formatted images on a 512 sectors backing device.
# Hence it needs an additional partprobe run.
/sbin/partprobe $IMG_LOOP
IMG_DEV=${IMG_LOOP}p3
else
IMG_LOOP=$(/sbin/losetup -f --show "$IMG")
IMG_LOOP=$(/sbin/losetup -b 4096 -f --show "$IMG")
IMG_DEV=${IMG_LOOP}
fi
else
@ -62,8 +65,12 @@ else
if [ "0$TEMPLATE_ROOT_WITH_PARTITIONS" -eq 1 ]; then
echo "-> Creating partition table"
# have static UUIDs to make partition table reproducible
sfdisk "$IMG" <<EOF || exit 1
IMG_LOOP=$(/sbin/losetup -b 4096 -P -f --show "$IMG")
# When a 4096 sectors formatted image gets created with the sfdisk, the partitions are automatically visible
# to the system. Hence no need to run additional partprobe.
# Have static UUIDs to make partition table reproducible
sfdisk "$IMG_LOOP" <<EOF || exit 1
label: gpt
label-id: f4796a2a-e377-45bd-b539-d6d49e569055
@ -72,17 +79,21 @@ size=2MiB, type=21686148-6449-6E6F-744E-656564454649, uuid=1e6c9db4-1e91-46c4-84
type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=693244e6-3e07-47bf-ad79-acade4293fe7, name="Root filesystem"
EOF
IMG_LOOP=$(/sbin/losetup -P -f --show "$IMG")
IMG_DEV=${IMG_LOOP}p3
else
IMG_LOOP=$(/sbin/losetup -f --show "$IMG")
IMG_LOOP=$(/sbin/losetup -b 4096 -f --show "$IMG")
IMG_DEV=${IMG_LOOP}
fi
# make sure the IMG_DEV is present
c=0; while [ ! -b $IMG_DEV ]; do sleep 1; c=$((c+1)); [ $c -ge 5 ] && break; done; unset c
echo "-> Creating filesystem..."
mkfs.ext4 -q -F "${IMG_DEV}" || exit 1
/sbin/mkfs.ext4 -q -F "${IMG_DEV}" || exit 1
fi
# make sure the IMG_DEV is present
c=0; while [ ! -b $IMG_DEV ]; do sleep 1; c=$((c+1)); [ $c -ge 5 ] && break; done; unset c
mount "${IMG_DEV}" "${INSTALLDIR}" || exit 1
trap "umount_kill $(readlink -m ${INSTALLDIR})" EXIT
"${SCRIPTSDIR}/01_install_core.sh"

View File

@ -72,12 +72,17 @@ fi
echo "--> Mounting $IMG"
mkdir -p mnt
if [ "0$TEMPLATE_ROOT_WITH_PARTITIONS" -eq 1 ]; then
IMG_LOOP=$(/sbin/losetup -P -f --show "$IMG")
IMG_LOOP=$(/sbin/losetup -b 4096 -P -f --show "$IMG")
# BUG: losetup's partscan (-P) does nothing when trying 4096 sectors formatted images on a 512 sectors backing device.
# Hence it needs an additional partprobe run.
/sbin/partprobe $IMG_LOOP
IMG_DEV=${IMG_LOOP}p3
else
IMG_LOOP=$(/sbin/losetup -f --show "$IMG")
IMG_LOOP=$(/sbin/losetup -b 4096 -f --show "$IMG")
IMG_DEV=${IMG_LOOP}
fi
# make sure the IMG_DEV is present
c=0; while [ ! -b $IMG_DEV ]; do sleep 1; c=$((c+1)); [ $c -ge 5 ] && break; done; unset c
mount "$IMG_DEV" mnt || exit 1
export INSTALLDIR=mnt
@ -94,8 +99,12 @@ _appmenus_dir="${APPMENUS_DIR:-${SCRIPTSDIR}}"
rm -f appmenus
if [ -d "${_appmenus_dir}/appmenus_${DIST}_${TEMPLATE_FLAVOR}" ]; then
ln -s "${_appmenus_dir}/appmenus_${DIST}_${TEMPLATE_FLAVOR}" appmenus
elif [ -d "${_appmenus_dir}/appmenus_${DIST//[0-9]*}_${TEMPLATE_FLAVOR}" ]; then
ln -s "${_appmenus_dir}/appmenus_${DIST//[0-9]*}_${TEMPLATE_FLAVOR}" appmenus
elif [ -d "${_appmenus_dir}/appmenus_$DIST" ]; then
ln -s "${_appmenus_dir}/appmenus_$DIST" appmenus
elif [ -d "${_appmenus_dir}/appmenus_${DIST//[0-9]*}" ]; then
ln -s "${_appmenus_dir}/appmenus_${DIST//[0-9]*}" appmenus
elif [ -d "${_appmenus_dir}/appmenus" ]; then
ln -s "${_appmenus_dir}/appmenus" appmenus
else
@ -111,7 +120,7 @@ mkdir mnt/home
echo "--> Linking /usr/local to /rw/usrlocal..."
mv mnt/usr/local mnt/usr/local.orig
ln -sf /rw/usrlocal mnt/usr/local
mkdir mnt/usr/local
echo "Reducing image size (calling cleanup_image)..."
ls -als $IMG

View File

@ -3,8 +3,9 @@
# This includes the VM's root image, patched with all qubes rpms, etc
#
%{!?version: %define version %(cat version)}
%{!?rel: %define rel %(cat build_timestamp_%{template_name})}
%{!?template_name: %global template_name %{getenv:TEMPLATE_NAME}}
%{!?version: %global version %(cat version)}
%{!?rel: %global rel %(cat build_timestamp_%{template_name} || echo unavailable)}
Name: qubes-template-%{template_name}
Version: %{version}
@ -17,6 +18,7 @@ Source: .
Requires: xdg-utils
Requires(post): tar
BuildArch: noarch
Provides: qubes-template
Obsoletes: %{name} > %{version}-%{release}
@ -76,6 +78,7 @@ if command -v qvm-template-postprocess >/dev/null 2>&1; then
fi
echo "--> Processing the root.img... (this might take a while)"
rm -f %{dest_dir}/root.img
cat %{dest_dir}/root.img.part.* | tar --sparse -xf - -C %{dest_dir}
rm -f %{dest_dir}/root.img.part.*
chown root.qubes %{dest_dir}/root.img

View File

@ -1 +1 @@
4.0.0
4.0.1