From d9af165a9b327f738decc6755c2732191f3c4658 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 12 Jul 2016 20:47:40 -0400 Subject: tidy --- Makefile | 22 +++++++---- common.sh | 55 ++++++++++++++++++++++++++++ config-etckeeper.PKGBUILD | 49 ++++++++++++++----------- config-pacman-mirrorlist-repo.PKGBUILD | 10 ++--- config-pacman-mirrorlist-repomirror.PKGBUILD | 10 ++--- config-pacman.PKGBUILD.sh | 39 -------------------- config-timedate-utc.PKGBUILD | 15 ++++++++ config-timedate.PKGBUILD | 18 --------- config-users-base.PKGBUILD | 11 ++---- config-winston-base.PKGBUILD | 33 +++++------------ config-winston-bootloader.PKGBUILD.sh | 20 ---------- config-winston-fstab.PKGBUILD.wip | 39 -------------------- 12 files changed, 133 insertions(+), 188 deletions(-) create mode 100644 common.sh delete mode 100644 config-pacman.PKGBUILD.sh create mode 100644 config-timedate-utc.PKGBUILD delete mode 100644 config-timedate.PKGBUILD delete mode 100644 config-winston-bootloader.PKGBUILD.sh delete mode 100644 config-winston-fstab.PKGBUILD.wip diff --git a/Makefile b/Makefile index 6eeb052..ecdf89a 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,22 @@ +SHELL = /bin/bash + all: config.db +.PHONY: all + +clean: + rm -f -- $(filter-out $(pkgfiles),$(wildcard *.pkg.tar.xz)) +.PHONY: clean -pkgbuilds = $(wildcard *.PKGBUILD) -$(foreach e,$(shell grep -e ^pkgver= -e ^pkgrel= -e ^pkgname= -- $(pkgbuilds)|sed 's/\.PKGBUILD:/./'),$(eval $e)) -$(foreach p,$(patsubst %.PKGBUILD,%,$(pkgbuilds)), \ - $(eval pkgfiles += $($p.pkgname)-$($p.pkgver)-$($p.pkgrel)-any.pkg.tar.xz) \ - $(eval $($p.pkgname)-$($p.pkgver)-$($p.pkgrel)-any.pkg.tar.xz: $p.PKGBUILD) ) +pkgbuilds = $(sort $(wildcard *.PKGBUILD)) +$(foreach p,$(pkgbuilds), $(eval $(shell BUILDFILE=$(abspath $p); . "$$BUILDFILE"; echo $(patsubst %.PKGBUILD,%,$p).pkgfile=$$pkgname-$$pkgver-$$pkgrel-any.pkg.tar.xz))) +$(foreach p,$(patsubst %.PKGBUILD,%,$(pkgbuilds)), \ + $(eval pkgfiles += $($p.pkgfile)) \ + $(eval $($p.pkgfile): $p.PKGBUILD) ) -%.pkg.tar.xz: - makepkg -d -f -p $< +%.pkg.tar.xz: common.sh + makepkg -d -p $(filter %.PKGBUILD,$^) %.db %.db.tar.gz %.files %.files.tar.gz: .var.pkgfiles $(pkgfiles) - find $^ -newer $*.db rm -f $*.db $*.db.tar.gz $*.files $*.files.tar.gz repo-add $*.db.tar.gz $(filter %.pkg.tar.xz,$^) touch --no-create --no-dereference $*.db $*.db.tar.gz $*.files $*.files.tar.gz diff --git a/common.sh b/common.sh new file mode 100644 index 0000000..5c9efac --- /dev/null +++ b/common.sh @@ -0,0 +1,55 @@ +pkgver=20160712 +pkgrel=1 +arch=(any) +pkgname=$(basename "$BUILDFILE" .PKGBUILD) + +pkgver() { + local oldpkgver oldpkgver_date oldpkgver_rel + local newpkgver newpkgver_date + oldpkgver="$pkgver" + oldpkgver_date=${oldpkgver%%.*} + oldpkgver_rel=${oldpkgver#${oldpkgver_date}}; oldpkgver_rel=${oldpkgver_rel#.}; oldpkgver_rel=${oldpkgver_rel:-0} + newpkgver_date=$(date +%Y%m%d) + # Handle doing multiple versions in the same day + if [[ "$newpkgver_date" == "$oldpkgver_date" ]]; then + declare -i newpkgver_rel=${oldpkgver_rel}+1 + newpkgver=${newpkgver_date}.${newpkgver_rel} + else + newpkgver=${newpkgver_date} + fi + echo $newpkgver +} + +netctl-enable() ( + . "etc/netctl/$1" + unit=netctl@"$(systemd-escape -- "$1")".service + install -Dm644 /dev/stdin etc/systemd/system/"${unit}" <> .gitignore <> .gitignore <> etc/pacman.conf - fi -} - -pre_remove() { - sed -i '/^Include = \/etc\/pacman\.d\/*\.conf$/d' etc/pacman.conf - trim -} diff --git a/config-timedate-utc.PKGBUILD b/config-timedate-utc.PKGBUILD new file mode 100644 index 0000000..62ac92b --- /dev/null +++ b/config-timedate-utc.PKGBUILD @@ -0,0 +1,15 @@ +. ${BUILDFILE%/*}/common.sh +pkgver=20160712.1 + +package() { +cd "$pkgdir" + +# Consider UTC to be the timezone, since we have admins all +# over the place. +install -d etc +ln -s ../usr/share/zoneinfo/UTC etc/localtime + +# Use timesyncd NTP client daemon. +add-unit etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service + +} diff --git a/config-timedate.PKGBUILD b/config-timedate.PKGBUILD deleted file mode 100644 index 8c8cf19..0000000 --- a/config-timedate.PKGBUILD +++ /dev/null @@ -1,18 +0,0 @@ -pkgver=1 -pkgrel=1 -arch=(any) - -pkgname=config-timedate - -package() { - cd "$pkgdir" - - install -dm755 etc/systemd/system/sysinit.target.wants - - # Consider UTC to be the timezone, since we have admins all - # over the place. - ln -s ../usr/share/zoneinfo/UTC etc/localtime - - # Use timesyncd NTP client daemon. - ln -s /usr/lib/systemd/system/systemd-timesyncd.service etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service -} diff --git a/config-users-base.PKGBUILD b/config-users-base.PKGBUILD index 72ffc35..036d834 100644 --- a/config-users-base.PKGBUILD +++ b/config-users-base.PKGBUILD @@ -1,19 +1,16 @@ -pkgver=1 -pkgrel=1 -arch=(any) - -pkgname=config-users-base +. ${BUILDFILE%/*}/common.sh +pkgver=20160712.1 package() { cd "$pkgdir" install -dm755 etc install -dm750 etc/sudoers.d -install -m644 /dev/stdin etc/sudoers.d/00-wheel <> etc/default/grub \ - 'GRUB_CMDLINE_LINUX_DEFAULT=""' \ - 'GRUB_TERMINAL_OUTPUT=console' -} - -pre_remove() { - sed -i \ - -e '/^GRUB_CMDLINE_LINUX_DEFAULT=""$/d' \ - -e '/^GRUB_TERMINAL_OUTPUT=console$/d' \ - etc/default/grub -} diff --git a/config-winston-fstab.PKGBUILD.wip b/config-winston-fstab.PKGBUILD.wip deleted file mode 100644 index 1996ee3..0000000 --- a/config-winston-fstab.PKGBUILD.wip +++ /dev/null @@ -1,39 +0,0 @@ -pkgver=1 -pkgrel=1 -arch=(any) -install=${BUILDFILE#${PWD}/} - -pkgname=config-winston-fstab -depends=(systemd-swap) - -package() { - cd "$pkgdir" - - ln -s /usr/lib/systemd/system/systemd-swap.service etc/systemd/system/local-fs.target.wants/systemd-swap.service - ln -s /usr/lib/systemd/system/remote-fs.target etc/systemd/system/multi-user.target.wants/remote-fs.target -} - -post_install() { - TODO - -cat >> etc/systemd-swap.conf <