#!/bin/sh
#
# Copyright (c) 2019 David Demelier <markand@malikania.fr>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

PKGNAME=etc
PKGVERSION=0.2
PKGREVISION=1
PKGLICENSE="ISC"
PKGSUMMARY="base system configuration files"
PKGPROTECT="etc/issue
            etc/fstab
            etc/group
            etc/passwd
            etc/profile
            etc/securetty
            etc/shadow
            etc/shells"

build()
{
	install -Dm0600 shadow $DESTDIR/etc/shadow
	install -Dm0644 fstab $DESTDIR/etc/fstab
	install -Dm0644 group $DESTDIR/etc/group
	install -Dm0644 issue $DESTDIR/etc/issue
	install -Dm0644 passwd $DESTDIR/etc/passwd
	install -Dm0644 profile $DESTDIR/etc/profile
	install -Dm0644 securetty $DESTDIR/etc/securetty
	install -Dm0644 shells $DESTDIR/etc/shells
	ln -sf /proc/self/mounts $DESTDIR/etc/mtab

	# Create /etc/vanilla-release information file.
	case $(uname -m) in
	'x86_64')
		arch="amd64"
		;;
	esac

	echo "VERSION=${PKGVERSION}" > $DESTDIR/etc/vanilla-release
	echo "ARCH=$arch" >> $DESTDIR/etc/vanilla-release
}
