From: Mark Wooding Date: Tue, 5 May 2020 19:50:25 +0000 (+0100) Subject: Merge branch 'master' into deploy.spirit X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/distorted-chroot/commitdiff_plain/8cc02f292047f4dbfa8b31d3cd8e078bc3658fe8?hp=fecf9644a3c004b3ea3aa9be085882341f0a11d2 Merge branch 'master' into deploy.spirit * master: Makefile: Add a new thing for running arbitrary commands. Makefile: Change the tag for maintenance to be `MAINT'. Makefile: Fix `squote' to have the right number of `\'s. bin/chroot-maint: Run `ldconfig' after an update. bin/chroot-maint: Fix mistakenly indented file-contents literals. --- diff --git a/Makefile b/Makefile index ea89661..c9befaf 100644 --- a/Makefile +++ b/Makefile @@ -274,7 +274,8 @@ throwrc = { $1; echo $$? >&4; } ## $(call squote,TXT) ## ## Single-quote TXT. -squote = '$(subst ','\\'',$1)' +squote = '$(subst ','\'',$1)' +#' ## $(call chroot-dist,D-A) -> D ## $(call chroot-arch,D-A) -> A @@ -638,7 +639,7 @@ JOBS = chroot cross-tools pkg-build MAINTQ_ = -q MAINTQ_0 = -q -MAINT = +$(call v_tag,RUN)\ +MAINT = +$(call v_tag,MAINT)\ PYTHONPATH=$(STATE)/lib/python $(STATE)/bin/chroot-maint \ $(MAINTQ_$V) $(OPTS) @@ -646,6 +647,19 @@ maint: all check $(MAINT) -f$(FRESH) $(JOBS) .PHONY: maint +###-------------------------------------------------------------------------- +### Running random commands. + +CMD = echo %d %a +subst-command = $(subst %d,$(call chroot-dist,$1), \ + $(subst %a,$(call chroot-arch,$1), \ + $(subst %r,$1, $(CMD)))) + +run: $(foreach c,$(ALL_CHROOTS),run/$c) +$(foreach c,$(ALL_CHROOTS),run/$c): run/%: + $(V_AT)$(call v_print,RUN,$(call subst-command,$*))\ + $(call subst-command,$*) + ###-------------------------------------------------------------------------- ### Other maintenance targets. diff --git a/bin/chroot-maint b/bin/chroot-maint index 6202f49..4dba315 100755 --- a/bin/chroot-maint +++ b/bin/chroot-maint @@ -2156,12 +2156,12 @@ class ChrootJob (BaseJob): with safewrite_root\ (OS.path.join(mnt, "fs/etc/apt/apt.conf.d/20arch")) as f: f.write("""\ - ### -*-conf-*- +### -*-conf-*- - APT { - Architecture "%s"; - }; - """ % arch) +APT { + Architecture "%s"; +}; +""" % arch) ## Set up the locale and time zone from the host system. progress("configure locales and timezone") @@ -2184,10 +2184,10 @@ class ChrootJob (BaseJob): with safewrite_root(OS.path.join(mnt, "fs/usr/sbin/policy-rc.d"), mode = "755") as f: f.write("""\ - #! /bin/sh - echo >&2 "policy-rc.d: Services disabled by policy." - exit 101 - """) +#! /bin/sh +echo >&2 "policy-rc.d: Services disabled by policy." +exit 101 +""") ## Hack the dynamic linker to prefer libraries in `/usr' over ## `/usr/local'. This prevents `dpkg-shlibdeps' from becoming @@ -2199,10 +2199,10 @@ class ChrootJob (BaseJob): with safewrite_root\ (OS.path.join(mnt, "fs/etc/ld.so.conf.d/zzz-local.conf")) as f: f.write("""\ - ### -*-conf-*- - ### Local hack to make /usr/local/ late. - /usr/local/lib - """) +### -*-conf-*- +### Local hack to make /usr/local/ late. +/usr/local/lib +""") ## If this is a foreign architecture then we need to set it up. if arch in C.FOREIGN_ARCHS: @@ -2253,6 +2253,7 @@ class ChrootJob (BaseJob): apt-get -y dist-upgrade apt-get -y autoremove apt-get -y clean + ldconfig """], stdin = DISCARD) if arch in C.FOREIGN_ARCHS: me._install_cross_tools() me._meta.update = zulu(); me._meta.write()