PKGBUILDs/core/filesystem/PKGBUILD
2017-04-01 00:26:39 +00:00

163 lines
4.3 KiB
Bash

# $Id$
# Maintainer: Sébastien Luttringer
# Contributor: Tom Gundersen <teg@jklm.no>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - modifed os-release
pkgname=filesystem
pkgver=2017.03
pkgrel=2
pkgdesc='Base Arch Linux files'
arch=('i686' 'x86_64')
license=('GPL')
url='https://www.archlinux.org'
groups=('base')
install='filesystem.install'
makedepends=('asciidoc')
depends=('iana-etc')
backup=('etc/fstab' 'etc/crypttab' 'etc/group' 'etc/hosts' 'etc/ld.so.conf' 'etc/passwd'
'etc/shadow' 'etc/gshadow' 'etc/resolv.conf' 'etc/motd' 'etc/nsswitch.conf'
'etc/shells' 'etc/host.conf' 'etc/securetty' 'etc/profile' 'etc/issue')
source=('group' 'issue' 'nsswitch.conf' 'securetty' 'host.conf' 'ld.so.conf'
'passwd' 'shadow' 'fstab' 'crypttab' 'hosts' 'motd' 'os-release' 'resolv.conf'
'shells' 'gshadow' 'profile' 'archlinux.7.txt' 'locale.sh')
md5sums=('76c80215d8dd395d3be4b8a711d585b6'
'7813c481156f6b280a3ba91fc6236368'
'7b21f0f97f048988908bf93778bba65f'
'4c4540eeb748bf1f71d631b8c1dcf0b3'
'f28150d4c0b22a017be51b9f7f9977ed'
'6e488ffecc8ba142c0cf7e2d7aeb832e'
'cb1a751b05541d8eebaace316de0e809'
'c0c27476ee248355bf308c8502a8c860'
'693c97f2c9a519bb97a17008e92c2b74'
'f0a5071f50d8864d2810c44e23eb00cc'
'7bc65f234dfb6abf24e7c3b03e86f4ff'
'd41d8cd98f00b204e9800998ecf8427e'
'52db9503314f639b8f47bd9a251a6ea9'
'6f48288b6fcaf0065fcb7b0e525413e0'
'22518e922891f9359f971f4f5b4e793c'
'c08581d4f982be8806d3afa912a65203'
'cfa3345c485c59e681ab39a44dc7ece1'
'2e193c4a37245f2323ebe87f1a673563'
'71ed98c52e11ada1f936ac8cb14eecd9')
lint() {
# ensure that passwd is sync'd to shadow and group is sync'd to gshadow.
local r=0
local passwd shadow group gshadow
for f in passwd shadow group gshadow; do
mapfile -t "$f" < <(cut -d: -f1 "$f" | sort)
done
# we can cheat and do simple string comparison only because we can make some
# assumptions about the data in these files
if [[ ${passwd[*]} != "${shadow[*]}" ]]; then
error 'passwd is not in sync with shadow!'
r=1
fi
if [[ ${group[*]} != "${gshadow[*]}" ]]; then
error 'group is not in sync with gshadow!'
r=1
fi
return $r
}
build() {
cd "$srcdir"
lint
a2x -d manpage -f manpage archlinux.7.txt
}
package() {
cd "$pkgdir"
#
# setup root filesystem
#
for d in boot dev etc home mnt usr var opt srv/http run; do
install -d -m755 $d
done
install -d -m555 proc
install -d -m555 sys
install -d -m0750 root
install -d -m1777 tmp
# vsftpd won't run with write perms on /srv/ftp
install -d -m555 -g ftp srv/ftp
# setup /etc and /usr/share/factory/etc
install -d etc/{ld.so.conf.d,skel,profile.d} usr/share/factory/etc
for f in fstab group host.conf hosts issue ld.so.conf motd nsswitch.conf passwd resolv.conf securetty shells profile; do
install -m644 "$srcdir"/$f etc/
install -m644 "$srcdir"/$f usr/share/factory/etc/
done
ln -s ../proc/self/mounts etc/mtab
for f in gshadow shadow crypttab; do
install -m600 "$srcdir"/$f etc/
install -m600 "$srcdir"/$f usr/share/factory/etc/
done
touch etc/arch-release
install -m755 "$srcdir"/locale.sh etc/profile.d/locale.sh
install -Dm644 "$srcdir"/os-release "$pkgdir"/usr/lib/os-release
# setup /var
for d in cache local opt log/old lib/misc empty; do
install -d -m755 var/$d
done
install -d -m1777 var/{tmp,spool/mail}
# allow setgid games to write scores
install -d -m775 -g games var/games
ln -s spool/mail var/mail
ln -s ../run var/run
ln -s ../run/lock var/lock
#
# setup /usr hierarchy
#
for d in bin include lib share/misc src; do
install -d -m755 usr/$d
done
for d in $(seq 8); do
install -d -m755 usr/share/man/man$d
done
#
# add lib symlinks
#
ln -s usr/lib "$pkgdir"/lib
[[ $CARCH = 'x86_64' ]] && (
ln -s usr/lib "$pkgdir"/lib64
ln -s lib "$pkgdir"/usr/lib64
)
#
# add bin symlinks
#
ln -s usr/bin "$pkgdir"/bin
ln -s usr/bin "$pkgdir"/sbin
ln -s bin "$pkgdir"/usr/sbin
#
# install archlinux(7) manpage
#
install -D -m644 "$srcdir"/archlinux.7 usr/share/man/man7/archlinux.7
#
# setup /usr/local hierarchy
#
for d in bin etc games include lib man sbin share src; do
install -d -m755 usr/local/$d
done
ln -s ../man usr/local/share/man
# remove conflict with systemd
rm usr/share/factory/etc/nsswitch.conf
}