use labels to create fstab
use swap partition if available update python (3.11) fix fetching stage3
This commit is contained in:
parent
774bb51363
commit
804560ea06
24
Makefile
24
Makefile
|
@ -112,6 +112,10 @@ endif
|
|||
|
||||
gcc_config = $(inroot) gcc-config 1
|
||||
|
||||
ifneq ($(shell grep 'CONFIG_MODULES=y' $(KERNEL_CONFIG)), )
|
||||
KERNEL_MODULES_PREPARE = modules_prepare
|
||||
endif
|
||||
|
||||
export APPLIANCE ACCEPT_KEYWORDS CHROOT EMERGE HEADLESS M4 M4C inroot
|
||||
export HOSTNAME MAKEOPTS TIMEZONE USEPKG WORLD
|
||||
export USEPKG RSYNC_MIRROR
|
||||
|
@ -133,14 +137,14 @@ $(PORTAGE_DIR):
|
|||
$(CHROOT)/etc/portage/%: configs/portage/%
|
||||
COPY --recursive $< /etc/portage/
|
||||
|
||||
$(CHROOT)/etc/fstab: configs/fstab.in
|
||||
ifeq ($(VIRTIO),YES)
|
||||
$(M4) -DDRIVE=sda $< > $@
|
||||
else
|
||||
$(M4) -DDRIVE=vda $< > $@
|
||||
endif
|
||||
fstab:
|
||||
@print Create new /etc/fstab
|
||||
echo -e "# <fs>\t\t<mountpoint>\t<type>\t<opts>\t<dump/pass>" > $(CHROOT)/etc/fstab
|
||||
echo -e "LABEL=ROOT\t/\t\text4\tnoatime\t1 1" >> $(CHROOT)/etc/fstab
|
||||
echo -e "/.swap\t\tnone\t\tswap\tsw\t0 0" >> $(CHROOT)/etc/fstab
|
||||
echo -e "#LABEL=SWAP\tnone\t\tswap\tsw\t0 0" >> $(CHROOT)/etc/fstab
|
||||
|
||||
$(PREPROOT): $(STAGE3) $(PORTAGE_DIR) $(foreach repo,$(REPO_NAMES),$(REPO_DIR)/$(repo)) $(CHROOT)/etc/fstab $(etc_portage) $(portage_default_package_files) $(portage_package_files)
|
||||
$(PREPROOT): $(STAGE3) $(PORTAGE_DIR) $(foreach repo,$(REPO_NAMES),$(REPO_DIR)/$(repo)) fstab $(etc_portage) $(portage_default_package_files) $(portage_package_files)
|
||||
mkdir -p $(VA_PKGDIR) $(DISTDIR)
|
||||
@print Creating swap file: `basename $(SWAP_FILE)`
|
||||
dd if=/dev/zero of=$(SWAP_FILE) bs=1M count=$(SWAP_SIZE)
|
||||
|
@ -225,7 +229,7 @@ ifneq ($(EXTERNAL_KERNEL),YES)
|
|||
cp -a $(CHROOT)/usr/src/linux-*/* $(shell cat $(KERNEL_PATH)); \
|
||||
RUN $(EMERGE) -C sys-kernel/$(KERNEL_PKG); \
|
||||
cp $(KERNEL_CONFIG) $(shell cat $(KERNEL_PATH))/.config; \
|
||||
## RUN make -C /usr/src/linux MAKEOPTS=$(MAKEOPTS) oldconfig modules_prepare; \
|
||||
RUN make -C /usr/src/linux MAKEOPTS=$(MAKEOPTS) oldconfig $(KERNEL_MODULES_PREPARE); \
|
||||
fi
|
||||
endif
|
||||
touch $(KERNEL_SRC)
|
||||
|
@ -338,7 +342,7 @@ $(RAW_IMAGE): $(STAGE4_TARBALL) scripts/grub.shell scripts/motd.sh
|
|||
parted -s $(RAW_IMAGE).tmp set 1 boot on
|
||||
sync
|
||||
losetup --show --find --partscan $(RAW_IMAGE).tmp > partitions
|
||||
mkfs.ext4 -O sparse_super,^has_journal -L "$(APPLIANCE)"_root -m 0 `cat partitions`p1
|
||||
mkfs.ext4 -O sparse_super,^has_journal -L ROOT -m 0 `cat partitions`p1
|
||||
mkdir $(CHROOT)
|
||||
mount -o noatime `cat partitions`p1 $(CHROOT)
|
||||
tar -xf $(STAGE4_TARBALL) --numeric-owner $(COPY_ARGS) -C $(CHROOT)
|
||||
|
@ -481,4 +485,4 @@ help:
|
|||
@print 'Example to build the base appliance'
|
||||
@echo 'make APPLIANCE=base HEADLESS=YES VIRTIO=YES stage4 qcow clean'
|
||||
|
||||
.PHONY: qcow vmdk ova clean realclean distclean stage4 image stage4 help appliance-list eclean sync_portage sync_stage3 checksums
|
||||
.PHONY: qcow vmdk ova clean realclean distclean stage4 image stage4 help appliance-list eclean sync_portage sync_stage3 checksums fstab
|
||||
|
|
|
@ -123,7 +123,7 @@ if [ ! -L "/dev/disk/by-label/$LABEL" ]; then
|
|||
exit 1
|
||||
fi
|
||||
if ! grep -Fq "LABEL=$LABEL" /etc/fstab; then
|
||||
echo "LABEL=$LABEL /$LABEL ext4 noatime 0 1" >> /etc/fstab
|
||||
echo -e "LABEL=$LABEL\t/$LABEL\t\text4\tnoatime\t0 1" >> /etc/fstab
|
||||
fi
|
||||
mount -a
|
||||
if ! mount | grep /$LABEL > /dev/null; then
|
||||
|
@ -131,6 +131,21 @@ if ! mount | grep /$LABEL > /dev/null; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
########################
|
||||
# Swap partition
|
||||
########################
|
||||
if [ -L "/dev/disk/by-label/SWAP" ]; then
|
||||
echo 'Swap partition found, mounting...'
|
||||
swapoff -a
|
||||
grep -Fv swap /etc/fstab > /etc/fstab.tmp && mv /etc/fstab.tmp /etc/fstab
|
||||
echo -e "LABEL=SWAP\tnone\t\tswap\tsw\t0 0" >> /etc/fstab
|
||||
swapon -a
|
||||
rm -f /.swap
|
||||
fi
|
||||
|
||||
echo 'Mount data partition...'
|
||||
|
||||
|
||||
########################
|
||||
# homedirs, users
|
||||
########################
|
||||
|
|
|
@ -5,6 +5,6 @@ MAKEOPTS="-j5"
|
|||
ACCEPT_LICENSE="*"
|
||||
|
||||
# Python-Version festpinnen (s. auch package.mask)
|
||||
USE_PYTHON="3.10"
|
||||
PYTHON_TARGETS="python3_10"
|
||||
PYTHON_SINGLE_TARGET="python3_10"
|
||||
USE_PYTHON="3.11"
|
||||
PYTHON_TARGETS="python3_11"
|
||||
PYTHON_SINGLE_TARGET="python3_11"
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# Python: nur Version 3.10 verwenden (s. auch make.conf: PYTHON-Variable)
|
||||
>=dev-lang/python-3.11
|
||||
# Python: nur Version 3.11 verwenden (s. auch make.conf: PYTHON-Variable)
|
||||
>=dev-lang/python-3.12
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
# <fs> <mountpoint> <type> <opts> <dump/pass>
|
||||
/dev/DRIVE1 / ext4 noatime 1 1
|
||||
/.swap none swap sw 0 0
|
File diff suppressed because it is too large
Load Diff
|
@ -9,10 +9,11 @@ import sys
|
|||
from collections import namedtuple
|
||||
|
||||
MIRROR = 'http://gentoo.osuosl.org/'
|
||||
Stage3 = namedtuple('Stage3', 'url cpu specialty minimal nomultilib systemd size')
|
||||
Stage3 = namedtuple('Stage3', 'url cpu specialty minimal nomultilib systemd mergedusr size')
|
||||
MINIMAL = re.compile(r'[\+-]minimal-')
|
||||
NOMULTILIB = re.compile(r'[\+-]nomultilib-')
|
||||
SYSTEMD = re.compile(r'[\+-]systemd-')
|
||||
MERGEDUSR = re.compile(r'[\+-]mergedusr-')
|
||||
|
||||
|
||||
def parse_args():
|
||||
|
@ -22,6 +23,7 @@ def parse_args():
|
|||
parser.add_argument('--no-multilib', action='store_true', default=False)
|
||||
parser.add_argument('--systemd', action='store_true', default=False)
|
||||
parser.add_argument('--minimal', action='store_true', default=False)
|
||||
parser.add_argument('--mergedusr', action='store_true', default=False)
|
||||
parser.add_argument('--outfile', type=str, default=None)
|
||||
parser.add_argument('arch', type=str)
|
||||
|
||||
|
@ -57,10 +59,13 @@ def get_manifest(arch, mirror=MIRROR):
|
|||
nomultilib = bool(NOMULTILIB.search(rest))
|
||||
systemd = 'systemd-' in rest
|
||||
systemd = bool(SYSTEMD.search(rest))
|
||||
mergedusr = 'mergedusr-' in rest
|
||||
mergedusr = bool(MERGEDUSR.search(rest))
|
||||
minimal = bool(MINIMAL.search(rest))
|
||||
|
||||
stage3 = Stage3(
|
||||
cpu=cpu,
|
||||
mergedusr=mergedusr,
|
||||
minimal=minimal,
|
||||
nomultilib=nomultilib,
|
||||
systemd=systemd,
|
||||
|
@ -93,11 +98,14 @@ def main():
|
|||
stage3 = None
|
||||
|
||||
for item in manifest:
|
||||
if not args.cpu and item.cpu != args.arch:
|
||||
continue
|
||||
if args.cpu and item.cpu != args.cpu:
|
||||
continue
|
||||
|
||||
if not all([
|
||||
args.minimal == item.minimal,
|
||||
args.mergedusr == item.mergedusr,
|
||||
args.no_multilib == item.nomultilib,
|
||||
args.systemd == item.systemd,
|
||||
args.specialty == item.specialty,
|
||||
|
|
Loading…
Reference in New Issue