summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-07-12 01:55:16 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-07-12 01:55:16 -0400
commitad057ec1d88d71018e1d82c2fb765a4f7a746579 (patch)
tree58d1e98dc79fae31dcd79d2542401de9a3227452
initial commit
-rw-r--r--.gitignore9
-rw-r--r--Makefile21
-rw-r--r--config-etckeeper.PKGBUILD61
-rw-r--r--config-pacman-mirrorlist-repo.PKGBUILD16
-rw-r--r--config-pacman-mirrorlist-repomirror.PKGBUILD16
-rw-r--r--config-pacman.PKGBUILD.sh39
-rw-r--r--config-timedate.PKGBUILD18
-rw-r--r--config-users-base.PKGBUILD22
-rw-r--r--config-winston-base.PKGBUILD.sh47
-rw-r--r--config-winston-bootloader.PKGBUILD.sh20
-rw-r--r--config-winston-fstab.PKGBUILD.wip39
-rw-r--r--config-winston-network.PKGBUILD44
-rwxr-xr-xwrite-ifchanged25
13 files changed, 377 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..860c242
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+*.db
+*.db.tar.gz
+*.files
+*.files.tar.gz
+/pkg/
+/src/
+*.pkg.tar.*
+/.var.*
+/.tmp.*
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6eeb052
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+all: config.db
+
+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) )
+
+%.pkg.tar.xz:
+ makepkg -d -f -p $<
+
+%.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
+
+.var.%: FORCE
+ @printf '%s' '$(subst ','\\'',$($*))' | sed 's/^/#/' | ./write-ifchanged $@
+-include $(wildcard .var.*)
+.PHONY: FORCE
diff --git a/config-etckeeper.PKGBUILD b/config-etckeeper.PKGBUILD
new file mode 100644
index 0000000..0bf09a5
--- /dev/null
+++ b/config-etckeeper.PKGBUILD
@@ -0,0 +1,61 @@
+pkgver=1
+pkgrel=1
+arch=(any)
+
+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
+
+# 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
+# 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 a stub to customize /etc/.gitignrore a bit
+install -Dm755 /dev/stdin etc/etckeeper/update-ignore.d/02custom <<_EOF_
+#!/bin/bash
+sed -i '/^# end section managed by etckeeper$/,$d' .gitignore
+cat >> .gitignore <<EOF
+# end section managed by etckeeper
+!/mtab
+/group-
+/gshadow-
+/passwd-
+/shadow-
+/resolv.conf
+EOF
+_EOF_
+
+# Add some other .gitignore files scattered around
+install -Dm644 /dev/stdin etc/ca-certificates/.gitignore <<EOF
+/trust-source/blacklist/
+/trust-source/anchors/
+/extracted/
+EOF
+install -Dm644 /dev/stdin etc/ssl/.gitignore <<EOF
+/certs/*.0
+/certs/*.1
+/certs/*.pem
+/certs/java/cacerts
+/.ssh/
+EOF
+install -Dm644 /dev/stdin etc/udev/.gitignore <<EOF
+/hwdb.bin
+EOF
+install -Dm644 /dev/stdin etc/pacman.d/.gitignore <<EOF
+/gnupg/
+EOF
+
+}
diff --git a/config-pacman-mirrorlist-repo.PKGBUILD b/config-pacman-mirrorlist-repo.PKGBUILD
new file mode 100644
index 0000000..875a888
--- /dev/null
+++ b/config-pacman-mirrorlist-repo.PKGBUILD
@@ -0,0 +1,16 @@
+pkgver=1
+pkgrel=1
+arch=(any)
+
+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
+EOF
+
+}
diff --git a/config-pacman-mirrorlist-repomirror.PKGBUILD b/config-pacman-mirrorlist-repomirror.PKGBUILD
new file mode 100644
index 0000000..fccddf0
--- /dev/null
+++ b/config-pacman-mirrorlist-repomirror.PKGBUILD
@@ -0,0 +1,16 @@
+pkgver=1
+pkgrel=1
+arch=(any)
+
+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
+EOF
+
+}
diff --git a/config-pacman.PKGBUILD.sh b/config-pacman.PKGBUILD.sh
new file mode 100644
index 0000000..a1d543b
--- /dev/null
+++ b/config-pacman.PKGBUILD.sh
@@ -0,0 +1,39 @@
+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.PKGBUILD b/config-timedate.PKGBUILD
new file mode 100644
index 0000000..8c8cf19
--- /dev/null
+++ b/config-timedate.PKGBUILD
@@ -0,0 +1,18 @@
+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
new file mode 100644
index 0000000..72ffc35
--- /dev/null
+++ b/config-users-base.PKGBUILD
@@ -0,0 +1,22 @@
+pkgver=1
+pkgrel=1
+arch=(any)
+
+pkgname=config-users-base
+
+package() {
+cd "$pkgdir"
+
+install -dm755 etc
+install -dm750 etc/sudoers.d
+install -m644 /dev/stdin etc/sudoers.d/00-wheel <<EOF
+%wheel ALL=(ALL) ALL
+EOF
+
+install -Dm644 /dev/stdin 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'
+EOF
+
+}
diff --git a/config-winston-base.PKGBUILD.sh b/config-winston-base.PKGBUILD.sh
new file mode 100644
index 0000000..1911902
--- /dev/null
+++ b/config-winston-base.PKGBUILD.sh
@@ -0,0 +1,47 @@
+pkgver=1
+pkgrel=1
+arch=(any)
+install=${BUILDFILE#${PWD}/}
+
+pkgname=config-winston-base
+depends=(linux-libre-lts haveged irqbalance)
+conflicts=(linux-libre)
+
+package() {
+cd "$pkgdir"
+
+install -Dm644 /dev/stdin etc/hostname <<EOF
+winston.parabola.nu
+EOF
+
+install -Dm644 /dev/stdin etc/machine-info <<EOF
+LOCATION=1984 Hosting Company, Iceland
+EOF
+
+install -Dm644 /dev/stdin etc/vconsole.conf <<EOF
+KEYMAP=us
+CONSOLEMAP=8859-1
+FONT_MAP=8859-1_to_uni
+EOF
+
+install -Dm644 /dev/stdin 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
+
+}
+
+post_install() {
+ sed -i 's/^#(en_US\.UTF-8)/\1/' etc/locale.gen
+ locale-gen
+}
+
+pre_remove() {
+ sed -i 's/^[^#]/#&/' etc/locale.gen
+ locale-gen
+}
diff --git a/config-winston-bootloader.PKGBUILD.sh b/config-winston-bootloader.PKGBUILD.sh
new file mode 100644
index 0000000..166545f
--- /dev/null
+++ b/config-winston-bootloader.PKGBUILD.sh
@@ -0,0 +1,20 @@
+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
new file mode 100644
index 0000000..1996ee3
--- /dev/null
+++ b/config-winston-fstab.PKGBUILD.wip
@@ -0,0 +1,39 @@
+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
+}
diff --git a/config-winston-network.PKGBUILD b/config-winston-network.PKGBUILD
new file mode 100644
index 0000000..6da7147
--- /dev/null
+++ b/config-winston-network.PKGBUILD
@@ -0,0 +1,44 @@
+pkgver=1
+pkgrel=1
+arch=(any)
+
+pkgname=config-winston-network
+depends=(netctl)
+
+package() {
+cd "$pkgdir"
+
+# /etc/udev/rules.d/80-net-setup-link.rules is a symlink to /dev/null,
+# which disables new-style [predictable network interface names][0]
+# (enp0s3? ens3?), and causes it to fall back to the old-style names
+# (eth0).
+#
+# [0]: https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/
+install -dm755 etc/udev/rules.d
+ln -s /dev/null etc/udev/rules.d/80-net-setup-link.rules
+
+# The netctl profile eth0-static just has the network information from
+# the 1984 VPS control panel.
+install -Dm644 /dev/stdin etc/netctl/eth0-static <<EOF
+Description='A basic static ethernet connection'
+Interface=eth0
+Connection=ethernet
+IP=static
+Address=('93.95.226.249/25')
+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'
+
+}
diff --git a/write-ifchanged b/write-ifchanged
new file mode 100755
index 0000000..185ceb0
--- /dev/null
+++ b/write-ifchanged
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+# Copyright (C) 2015 Luke Shumaker
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+outfile=$1
+tmpfile="$(dirname "$outfile")/.tmp${outfile##*/}"
+
+cat > "$tmpfile" || exit $?
+if cmp -s "$tmpfile" "$outfile"; then
+ rm -f "$tmpfile" || :
+else
+ mv -f "$tmpfile" "$outfile"
+fi