diff options
-rw-r--r-- | Makefile | 22 | ||||
-rw-r--r-- | common.sh | 55 | ||||
-rw-r--r-- | config-etckeeper.PKGBUILD | 49 | ||||
-rw-r--r-- | config-pacman-mirrorlist-repo.PKGBUILD | 10 | ||||
-rw-r--r-- | config-pacman-mirrorlist-repomirror.PKGBUILD | 10 | ||||
-rw-r--r-- | config-pacman.PKGBUILD.sh | 39 | ||||
-rw-r--r-- | config-timedate-utc.PKGBUILD | 15 | ||||
-rw-r--r-- | config-timedate.PKGBUILD | 18 | ||||
-rw-r--r-- | config-users-base.PKGBUILD | 11 | ||||
-rw-r--r-- | config-winston-base.PKGBUILD | 33 | ||||
-rw-r--r-- | config-winston-bootloader.PKGBUILD.sh | 20 | ||||
-rw-r--r-- | config-winston-fstab.PKGBUILD.wip | 39 |
12 files changed, 133 insertions, 188 deletions
@@ -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}" <<EOF +.include /usr/lib/systemd/system/netctl@.service + +[Unit] +Description=${Description} +BindsTo=sys-subsystem-net-devices-${Interface}.device +After=sys-subsystem-net-devices-${Interface}.device +EOF + add-unit etc/systemd/system/multi-user.target.wants/"$unit" +) + +add-unit() ( + install -dm755 "${1%/*}" + base="$(sed 's/@[^.]\./@./' <<<"${1##*/}")" + srcs=( + "etc/systemd/system/${1##*/}" + "etc/systemd/system/$base" + "usr/lib/systemd/system/$base" + ) + for src in "${srcs[@]}"; do + if test -f "$src"; then + break + fi + done + ln -s "$src" "$1" +) + +add-file() { + install -Dm644 /dev/stdin "$@" +} diff --git a/config-etckeeper.PKGBUILD b/config-etckeeper.PKGBUILD index 0bf09a5..1cbd779 100644 --- a/config-etckeeper.PKGBUILD +++ b/config-etckeeper.PKGBUILD @@ -1,32 +1,36 @@ -pkgver=1 -pkgrel=1 -arch=(any) +. ${BUILDFILE%/*}/common.sh +pkgver=20160712.2 -pkgname=config-etckeeper depends=(etckeeper pristine-etc-keeper) package() { cd "$pkgdir" -install -dm755 etc/systemd/system/multi-user.target.wants -# etckeeper is configured to use git (the default) to keep track of -# changes in /etc. The systemd unit etckeeper.timer is enabled, which -# makes a commit (if necessary) daily. It will also run before and -# after pacman via libalpm hooks. -ln -s /usr/lib/systemd/system/etckeeper.timer etc/systemd/system/multi-user.target.wants/etckeeper.timer +# [https://www.parabola.nu/packages/community/any/etckeeper/ +# etckeeper] is configured to use git (the default) to keep track of +# changes in `/etc`. The systemd unit etckeeper.timer is enabled, +# which makes a commit (if necessary) daily. It will also run before +# and after pacman via libalpm hooks. +add-unit etc/systemd/system/multi-user.target.wants/etckeeper.timer # In addition to etckeeper keeping track of the current configuration, -# lukeshu's pristine-etc-keeper maintains a branch of what /etc would -# be like if we never made any changes from the default files. The -# clean version of etc is available as the clean remote's master +# lukeshu's +# [https://www.parabola.nu/packages/pcr/any/pristine-etc-keeper-git/ +# pristine-etc-keeper] maintains a branch of what `/etc` would be like +# if we never made any changes from the default files. The clean +# version of etc is available as the clean remote's master # branch. Doing a git diff clean/master master should be helpful in # investigating how things have been configured. -ln -s /usr/lib/systemd/system/pristine-etc-keeper.timer etc/systemd/system/multi-user.target.wants/pristine-etc-keeper.timer +add-unit etc/systemd/system/multi-user.target.wants/pristine-etc-keeper.timer -# Add a stub to customize /etc/.gitignrore a bit -install -Dm755 /dev/stdin etc/etckeeper/update-ignore.d/02custom <<_EOF_ +# The etckeeper update-ignore hook is customized to ignore a couple +# more files in `/etc` (and avoid ignoring `/etc/mtab`). We ignore +# `resolv.conf` because it is managed by +# [https://www.parabola.nu/packages/core/any/openresolv/ +# openresolv/resolvconf]. +add-file -m755 etc/etckeeper/update-ignore.d/02custom <<_EOF_ #!/bin/bash -sed -i '/^# end section managed by etckeeper$/,$d' .gitignore +sed -i '/^# end section managed by etckeeper\$/,\$d' .gitignore cat >> .gitignore <<EOF # end section managed by etckeeper !/mtab @@ -38,23 +42,24 @@ cat >> .gitignore <<EOF EOF _EOF_ -# Add some other .gitignore files scattered around -install -Dm644 /dev/stdin etc/ca-certificates/.gitignore <<EOF +# For files in subdirectories of `/etc`, we use separate `.gitignore` +# files in each directory: +add-file etc/ca-certificates/.gitignore <<EOF /trust-source/blacklist/ /trust-source/anchors/ /extracted/ EOF -install -Dm644 /dev/stdin etc/ssl/.gitignore <<EOF +add-file etc/ssl/.gitignore <<EOF /certs/*.0 /certs/*.1 /certs/*.pem /certs/java/cacerts /.ssh/ EOF -install -Dm644 /dev/stdin etc/udev/.gitignore <<EOF +add-file etc/udev/.gitignore <<EOF /hwdb.bin EOF -install -Dm644 /dev/stdin etc/pacman.d/.gitignore <<EOF +add-file etc/pacman.d/.gitignore <<EOF /gnupg/ EOF diff --git a/config-pacman-mirrorlist-repo.PKGBUILD b/config-pacman-mirrorlist-repo.PKGBUILD index 875a888..d395dc3 100644 --- a/config-pacman-mirrorlist-repo.PKGBUILD +++ b/config-pacman-mirrorlist-repo.PKGBUILD @@ -1,16 +1,14 @@ -pkgver=1 -pkgrel=1 -arch=(any) +. ${BUILDFILE%/*}/common.sh +pkgver=20160712.1 -pkgname=config-pacman-mirrorlist-repo provides=(pacman-mirrorlist) conflicts=(pacman-mirrorlist) package() { cd "$pkgdir" -install -Dm644 /dev/stdin etc/pacman.d/mirrorlist <<EOF -Server = https://repo.parabola.nu/$repo/os/$arch +add-file etc/pacman.d/mirrorlist <<EOF +Server = https://repo.parabola.nu/\$repo/os/\$arch EOF } diff --git a/config-pacman-mirrorlist-repomirror.PKGBUILD b/config-pacman-mirrorlist-repomirror.PKGBUILD index fccddf0..35b1f74 100644 --- a/config-pacman-mirrorlist-repomirror.PKGBUILD +++ b/config-pacman-mirrorlist-repomirror.PKGBUILD @@ -1,16 +1,14 @@ -pkgver=1 -pkgrel=1 -arch=(any) +. ${BUILDFILE%/*}/common.sh +pkgver=20160712.1 -pkgname=config-pacman-mirrorlist-repomirror provides=(pacman-mirrorlist) conflicts=(pacman-mirrorlist) package() { cd "$pkgdir" -install -Dm644 /dev/stdin etc/pacman.d/mirrorlist <<EOF -Server = https://repomirror.parabola.nu/$repo/os/$arch +add-file etc/pacman.d/mirrorlist <<EOF +Server = https://repomirror.parabola.nu/\$repo/os/\$arch EOF } diff --git a/config-pacman.PKGBUILD.sh b/config-pacman.PKGBUILD.sh deleted file mode 100644 index a1d543b..0000000 --- a/config-pacman.PKGBUILD.sh +++ /dev/null @@ -1,39 +0,0 @@ -pkgver=1 -pkgrel=1 -arch=(any) -install=${BUILDFILE#${PWD}/} - -pkgname=config-pacman - -package() { -cd "$pkgdir" - -install -Dm644 /dev/stdin etc/pacman.d/repo-pcr.conf <<EOF -[pcr] -Include = /etc/pacman.d/mirrorlist -EOF - -install -Dm644 /dev/stdin etc/pacman.d/repo-config.conf <<EOF -[config] -Server = https://config.parabola.nu/repo -EOF - -} - -trim() { - while [[ -z "$(sed -n '$p' < etc/pacman.conf)" ]]; do - sed -i '$/^$/d' etc/pacman.conf - done -} - -post_install() { - if ! grep -Fxq 'Include = /etc/pacman.d/*.conf' etc/pacman.conf; then - trim - printf '%s\n' '' 'Include = /etc/pacman.d/*.conf' >> 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 <<EOF +add-file etc/sudoers.d/00-wheel <<EOF %wheel ALL=(ALL) ALL EOF -install -Dm644 /dev/stdin etc/systemd/system/shadow.service.d/sort.conf <<EOF +add-file etc/systemd/system/shadow.service.d/sort.conf <<EOF [Service] ExecStart=/bin/bash -c '/usr/bin/pwck -r && /usr/bin/pwck -s' ExecStart=/bin/bash -c '/usr/bin/grpck -r && /usr/bin/grpck -s' diff --git a/config-winston-base.PKGBUILD b/config-winston-base.PKGBUILD index a8beb86..73f57f1 100644 --- a/config-winston-base.PKGBUILD +++ b/config-winston-base.PKGBUILD @@ -1,8 +1,6 @@ -pkgver=1 -pkgrel=1 -arch=(any) +. ${BUILDFILE%/*}/common.sh +pkgver=20160712.1 -pkgname=config-winston-base depends=(linux-libre-lts grub haveged irqbalance netctl) conflicts=(linux-libre) @@ -11,29 +9,28 @@ cd "$pkgdir" ## Base setup ## -install -Dm644 /dev/stdin etc/hostname <<EOF +add-file etc/hostname <<EOF winston.parabola.nu EOF -install -Dm644 /dev/stdin etc/machine-info <<EOF +add-file etc/machine-info <<EOF LOCATION=1984 Hosting Company, Iceland EOF -install -Dm644 /dev/stdin etc/vconsole.conf <<EOF +add-file etc/vconsole.conf <<EOF KEYMAP=us CONSOLEMAP=8859-1 FONT_MAP=8859-1_to_uni EOF -install -Dm644 /dev/stdin etc/locale.conf <<EOF +add-file etc/locale.conf <<EOF LANG=en_US.UTF-8 LC_COLLATE=C EOF -install -dm755 etc/systemd/system/multi-user.target.wants -ln -s /usr/lib/systemd/system/getty@.service etc/systemd/system/multi-user.target.wants/getty@tty1.service -ln -s /usr/lib/systemd/system/haveged.service etc/systemd/system/multi-user.target.wants/haveged.service -ln -s /usr/lib/systemd/system/irqbalance.service etc/systemd/system/multi-user.target.wants/irqbalance.service +add-unit etc/systemd/system/multi-user.target.wants/getty@tty1.service +add-unit etc/systemd/system/multi-user.target.wants/haveged.service +add-unit etc/systemd/system/multi-user.target.wants/irqbalance.service ## Networking ## @@ -58,16 +55,6 @@ Gateway='93.95.226.129' DNS=('93.95.224.28' '93.95.224.29') EOF -# This is just `netctl enable eth0-static` -install -Dm644 /dev/stdin 'etc/systemd/system/netctl@eth0\x2dstatic.service' <<EOF -.include /usr/lib/systemd/system/netctl@.service - -[Unit] -Description=A basic static ethernet connection -BindsTo=sys-subsystem-net-devices-eth0.device -After=sys-subsystem-net-devices-eth0.device -EOF -install -dm755 etc/systemd/system/multi-user.target.wants -ln -s 'etc/systemd/system/netctl@eth0\x2dstatic.service' 'etc/systemd/system/multi-user.target.wants/netctl@eth0\x2dstatic.service' +netctl-enable eth0-static } diff --git a/config-winston-bootloader.PKGBUILD.sh b/config-winston-bootloader.PKGBUILD.sh deleted file mode 100644 index 166545f..0000000 --- a/config-winston-bootloader.PKGBUILD.sh +++ /dev/null @@ -1,20 +0,0 @@ -pkgver=1 -pkgrel=1 -arch=(any) -install=${BUILDFILE#${PWD}/} - -pkgname=config-winston-bootloader -depends=(grub linux-libre-lts) - -post_install() { - printf '%s\n' >> 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 <<EOF - -swapd[parse]=1 -swapf[Poff]=1 -swapf[fstab]=1 -sys[cpu_count]=8 -sys[ram_size]=4460544K -zram[alg]=lz4 -zram[size]=4460544K -zram[streams]=8 -zswap[enabled]=0 -zswap[compressor]=lz4 -zswap[max_pool_percent]=20 -zswap[zpool]=zbud -EOF - -} - -pre_remove() { - TODO -} |