diff options
Diffstat (limited to 'pcr')
45 files changed, 2224 insertions, 0 deletions
diff --git a/pcr/eudev-systemdcompat/PKGBUILD b/pcr/eudev-systemdcompat/PKGBUILD new file mode 100644 index 000000000..1b49220ad --- /dev/null +++ b/pcr/eudev-systemdcompat/PKGBUILD @@ -0,0 +1,46 @@ +# Maintainer : freaj <freaj@riseup.net> +# Maintainer (Manjaro): artoo <artoo@manjaro.org> +# Contributor (Manjaro): Philip Müller <philm|manjaro|org> +# Contributor (Manjaro): Dave Reisner <dreisner@archlinux.org> +# Contributor (Manjaro): Tom Gundersen <teg@jklm.no> + +_spkgrel=8 + +pkgname=eudev-systemdcompat +pkgver=217 +pkgrel=4 +pkgdesc="systemd client libraries without udev; systemd compatibility package" +arch=('i686' 'x86_64') +license=('GPL2') +groups=('eudev-base') +url="http://www.freedesktop.org/wiki/Software/systemd" +provides=("libsystemd=${pkgver}" + "systemd=${pkgver}" + "systemd-tools=${pkgver}" + 'libsystemd.so' + 'libsystemd-daemon.so' + 'libsystemd-id128.so' + 'libsystemd-journal.so' + 'libsystemd-login.so') +depends=('glib2' 'glibc' 'libgcrypt' 'xz' 'eudev>=1.10') +optdepends=('eudev-openrc: eudev initscript' + 'upower-pm-utils: pm-utils support') +conflicts=('systemd' + 'systemd-tools' + 'libsystemd') + +if [ "$CARCH" = "i686" ]; then + source=("http://seblu.net/a/arm/2014/12/01/core/os/i686/libsystemd-$pkgver-${_spkgrel}-i686.pkg.tar.xz") + sha256sums=('d152416683063681072ae1dbbb3d61e267eb523765a6f0bf81cea457a585edff') +elif [ "$CARCH" = "x86_64" ]; then + source=("http://seblu.net/a/arm/2014/12/01/core/os/x86_64/libsystemd-$pkgver-${_spkgrel}-x86_64.pkg.tar.xz") + sha256sums=('3bda8ac94e23f3b3b73de9d2aff6b2e23d601007302e80893a31c9502505cd3e') +fi + +prepare() { + rm usr/lib/lib{g,}udev*.so* +} + +package() { + mv "$srcdir/usr/" "$pkgdir" +} diff --git a/pcr/eudev/PKGBUILD b/pcr/eudev/PKGBUILD new file mode 100644 index 000000000..095bb04d5 --- /dev/null +++ b/pcr/eudev/PKGBUILD @@ -0,0 +1,63 @@ +# Maintainer : freaj <freaj@riseup.net> +# Maintainer (Manjaro): artoo <artoo@manjaro.org> +# Contributor (Manjaro): Alexey D. <lq07829icatm@rambler.ru> +# Contributor (Manjaro): Ivailo Monev <xakepa10@gmail.com> + +_udev_ver=217 +_src_uri='http://dev.gentoo.org/~blueness/eudev' + +pkgname=eudev +pkgver=2.1.1 +pkgrel=3 +pkgdesc="The userspace dev tools (udev) forked by Gentoo" +arch=('i686' 'x86_64') +url="http://www.gentoo.org/proj/en/eudev/" +license=('GPL') +depends=('glib2' 'kbd' 'kmod' 'hwids' 'util-linux') +makedepends=('gobject-introspection' 'gperf' 'gtk-doc' 'intltool') +optdepends=('eudev-systemdcompat: makes packages compiled with systemd features run' + 'upower-pm-utils: pm-utils support') +provides=("udev=${_udev_ver}" + "libudev=${_udev_ver}" + 'libgudev-1.0.so' + 'libudev.so') +conflicts=('libgudev-1.0.so' 'libudev.so') +backup=('etc/udev/udev.conf') +options=(!makeflags !libtool) +source=("${_src_uri}/${pkgname}-${pkgver}.tar.gz" + 'initcpio_hooks' + 'initcpio_install') +sha256sums=('6aef101c5496a2dc45e669307d478dbccb0ee0462a285512edcda51ff12e0e6a' + '892ce43218e0a458981bbce451252c8987dc398e60b8de288e7542b8f2409c13' + '1a70e48d5f5b476ed624f745b03988f2e8950e33ae864c6b1c4ef088882c8390') + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + ./configure \ + --prefix=/usr \ + --with-rootprefix=/usr \ + --sysconfdir=/etc \ + --libdir=/usr/lib \ + --sbindir=/usr/bin \ + --with-modprobe=/usr/bin/modprobe \ + --with-html-dir=/usr/share/doc/${pkgname}-${pkgver}/html \ + --enable-gudev \ + --enable-introspection \ + --enable-split-usr \ + --enable-rule-generator + make +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + make DESTDIR="${pkgdir}" install + + for i in "${pkgdir}/usr/lib/udev/rules.d/"*.rules; do + sed -i -e 's#GROUP="dialout"#GROUP="uucp"#g; + s#GROUP="tape"#GROUP="storage"#g; + s#GROUP="cdrom"#GROUP="optical"#g' "${i}" + done + + install -Dm644 "${srcdir}/initcpio_hooks" "${pkgdir}/usr/lib/initcpio/hooks/udev" + install -Dm644 "${srcdir}/initcpio_install" "${pkgdir}/usr/lib/initcpio/install/udev" +} diff --git a/pcr/eudev/initcpio_hooks b/pcr/eudev/initcpio_hooks new file mode 100755 index 000000000..75da7e4a8 --- /dev/null +++ b/pcr/eudev/initcpio_hooks @@ -0,0 +1,20 @@ +#!/usr/bin/ash + +run_earlyhook() { + udevd --daemon --resolve-names=never + udevd_running=1 +} + +run_hook() { + msg ":: Triggering uevents..." + udevadm trigger --action=add --type=subsystems + udevadm trigger --action=add --type=devices + udevadm settle +} + +run_cleanuphook() { + udevadm control --exit + udevadm info --cleanup-db +} + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/pcr/eudev/initcpio_install b/pcr/eudev/initcpio_install new file mode 100755 index 000000000..9c1ac6da3 --- /dev/null +++ b/pcr/eudev/initcpio_install @@ -0,0 +1,27 @@ +#!/bin/bash + +build() { + add_file "/etc/udev/udev.conf" + add_binary /usr/bin/udevd + add_binary /usr/bin/udevadm + + for rule in 50-udev-default.rules 60-persistent-storage.rules 64-btrfs.rules 80-drivers-modprobe.rules; do + add_file "/usr/lib/udev/rules.d/$rule" + done + + for tool in ata_id scsi_id; do + add_file "/usr/lib/udev/$tool" + done + + add_runscript +} + +help() { + cat <<HELPEOF +This hook will use udev to create your root device node and detect the needed +modules for your root device. It is also required for firmware loading in +initramfs. It is recommended to use this hook. +HELPEOF +} + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/pcr/openrc-base/1.0.6-dmcrypt.confd b/pcr/openrc-base/1.0.6-dmcrypt.confd new file mode 100644 index 000000000..9747dff11 --- /dev/null +++ b/pcr/openrc-base/1.0.6-dmcrypt.confd @@ -0,0 +1,98 @@ +# /etc/conf.d/dmcrypt + +# For people who run dmcrypt on top of some other layer (like raid), +# use rc_need to specify that requirement. See the runscript(8) man +# page for more information. + +#-------------------- +# Instructions +#-------------------- + +# Note regarding the syntax of this file. This file is *almost* bash, +# but each line is evaluated separately. Separate swaps/targets can be +# specified. The init-script which reads this file assumes that a +# swap= or target= line starts a new section, similar to lilo or grub +# configuration. + +# Note when using gpg keys and /usr on a separate partition, you will +# have to copy /usr/bin/gpg to /bin/gpg so that it will work properly +# and ensure that gpg has been compiled statically. +# See http://bugs.gentoo.org/90482 for more information. + +# Note that the init-script which reads this file detects whether your +# partition is LUKS or not. No mkfs is run unless you specify a makefs +# option. + +# Global options: +#---------------- + +# Max number of checks to perform (1 per second) +#dmcrypt_max_timeout=120 + +# Arguments: +#----------- +# target=<name> == Mapping name for partition. +# swap=<name> == Mapping name for swap partition. +# source='<dev>' == Real device for partition. +# key='</path/to/keyfile>[:<mode>]' == Fullpath from / or from inside removable media. +# remdev='<dev>' == Device that will be assigned to removable media. +# gpg_options='<opts>' == Default are --quiet --decrypt +# options='<opts>' == cryptsetup, for LUKS you can only use --readonly +# loop_file='<file>' == Loopback file. +# pre_mount='cmds' == commands to execute before mounting partition. +# post_mount='cmds' == commands to execute after mounting partition. +#----------- +# Supported Modes +# gpg == decrypt and pipe key into cryptsetup. +# Note: new-line character must not be part of key. +# Command to erase \n char: 'cat key | tr -d '\n' > cleanKey' + +#-------------------- +# dm-crypt examples +#-------------------- + +## swap +# Swap partitions. These should come first so that no keys make their +# way into unencrypted swap. +# If no options are given, they will default to: -c aes -h sha1 -d /dev/urandom +# If no makefs is given then mkswap will be assumed +#swap=crypt-swap +#source='/dev/hda2' + +## /home with passphrase +#target=crypt-home +#source='/dev/hda5' + +## /home with regular keyfile +#target=crypt-home +#source='/dev/hda5' +#key='/full/path/to/homekey' + +## /home with gpg protected key +#target=crypt-home +#source='/dev/hda5' +#key='/full/path/to/homekey:gpg' + +## /home with regular keyfile on removable media(such as usb-stick) +#target=crypt-home +#source='/dev/hda5' +#key='/full/path/to/homekey' +#remdev='/dev/sda1' + +##/home with gpg protected key on removable media(such as usb-stick) +#target=crypt-home +#source='/dev/hda5' +#key='/full/path/to/homekey:gpg' +#remdev='/dev/sda1' + +##/tmp with regular keyfile +#target=crypt-tmp +#source='/dev/hda6' +#key='/full/path/to/tmpkey' +#pre_mount='/sbin/mkreiserfs -f -f ${dev}' +#post_mount='chown root:root ${mount_point}; chmod 1777 ${mount_point}' + +## Loopback file example +#target='crypt-loop-home' +#source='/dev/loop0' +#loop_file='/mnt/crypt/home' diff --git a/pcr/openrc-base/1.5.1-dmcrypt.rc b/pcr/openrc-base/1.5.1-dmcrypt.rc new file mode 100644 index 000000000..9415a0bce --- /dev/null +++ b/pcr/openrc-base/1.5.1-dmcrypt.rc @@ -0,0 +1,353 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/1.5.1-dmcrypt.rc,v 1.2 2014/10/19 04:37:19 vapier Exp $ + +depend() { + before checkfs fsck +} + +# We support multiple dmcrypt instances based on $SVCNAME +execute_hook="dm_crypt_execute_dmcrypt" +# XXX: Should we drop this ? +# execute_hook="dm_crypt_execute_localmount" +conf_file="/etc/conf.d/${SVCNAME}" + +# Get splash helpers if available. +if [ -e /sbin/splash-functions.sh ] ; then + . /sbin/splash-functions.sh +fi + +# Setup mappings for an individual target/swap +# Note: This relies on variables localized in the main body below. +dm_crypt_execute_dmcrypt() { + local dev ret mode foo + + if [ -n "${target}" ] ; then + # let user set options, otherwise leave empty + : ${options:=' '} + elif [ -n "${swap}" ] ; then + if cryptsetup isLuks ${source} 2>/dev/null ; then + ewarn "The swap you have defined is a LUKS partition. Aborting crypt-swap setup." + return + fi + target=${swap} + # swap contents do not need to be preserved between boots, luks not required. + # suspend2 users should have initramfs's init handling their swap partition either way. + : ${options:='-c aes -h sha1 -d /dev/urandom'} + : ${pre_mount:='mkswap ${dev}'} + else + return + fi + if [ "x${source#UUID}" != "x${source}" ]; then + source=${source#UUID=} + source="$(blkid -U ${source})" + fi + if [ -z "${source}" ] && [ ! -e "${source}" ] ; then + ewarn "source \"${source}\" for ${target} missing, skipping..." + return + fi + + if [ -n "${loop_file}" ] ; then + dev="/dev/mapper/${target}" + ebegin " Setting up loop device ${source}" + losetup ${source} ${loop_file} + fi + + # cryptsetup: + # open <device> <name> # <device> is $source + # create <name> <device> # <name> is $target + local arg1="create" arg2="${target}" arg3="${source}" + if cryptsetup isLuks ${source} 2>/dev/null ; then + arg1="open" + arg2="${source}" + arg3="${target}" + fi + + # Older versions reported: + # ${target} is active: + # Newer versions report: + # ${target} is active[ and is in use.] + if cryptsetup status ${target} | egrep -q ' is active' ; then + einfo "dm-crypt mapping ${target} is already configured" + return + fi + splash svc_input_begin ${SVCNAME} >/dev/null 2>&1 + + # Handle keys + if [ -n "${key}" ] ; then + read_abort() { + # some colors + local ans savetty resettty + [ -z "${NORMAL}" ] && eval $(eval_ecolors) + einfon " $1? (${WARN}yes${NORMAL}/${GOOD}No${NORMAL}) " + shift + # This is ugly as s**t. But POSIX doesn't provide `read -t`, so + # we end up having to implement our own crap with stty/etc... + savetty=$(stty -g) + resettty='stty ${savetty}; trap - EXIT HUP INT TERM' + trap 'eval "${resettty}"' EXIT HUP INT TERM + stty -icanon + [ "${1}" = -t ] && stty min 0 time "$(( $2 * 10 ))" + ans=$(dd count=1 bs=1 2>/dev/null) || ans='' + eval "${resettty}" + if [ -z "${ans}" ] ; then + printf '\r' + else + echo + fi + case ${ans} in + [yY]) return 0;; + *) return 1;; + esac + } + + # Notes: sed not used to avoid case where /usr partition is encrypted. + mode=${key/*:/} && ( [ "${mode}" = "${key}" ] || [ -z "${mode}" ] ) && mode=reg + key=${key/:*/} + case "${mode}" in + gpg|reg) + # handle key on removable device + if [ -n "${remdev}" ] ; then + # temp directory to mount removable device + local mntrem="${RC_SVCDIR}/dm-crypt-remdev.$$" + if [ ! -d "${mntrem}" ] ; then + if ! mkdir -p "${mntrem}" ; then + ewarn "${source} will not be decrypted ..." + einfo "Reason: Unable to create temporary mount point '${mntrem}'" + return + fi + fi + i=0 + einfo "Please insert removable device for ${target}" + while [ ${i} -lt ${dmcrypt_max_timeout:-120} ] ; do + foo="" + if mount -n -o ro "${remdev}" "${mntrem}" 2>/dev/null >/dev/null ; then + # keyfile exists? + if [ ! -e "${mntrem}${key}" ] ; then + umount -n "${mntrem}" + rmdir "${mntrem}" + einfo "Cannot find ${key} on removable media." + read_abort "Abort" ${read_timeout:--t 1} && return + else + key="${mntrem}${key}" + break + fi + else + [ -e "${remdev}" ] \ + && foo="mount failed" \ + || foo="mount source not found" + fi + : $((i += 1)) + read_abort "Stop waiting after $i attempts (${foo})" -t 1 && return + done + else # keyfile ! on removable device + if [ ! -e "${key}" ] ; then + ewarn "${source} will not be decrypted ..." + einfo "Reason: keyfile ${key} does not exist." + return + fi + fi + ;; + *) + ewarn "${source} will not be decrypted ..." + einfo "Reason: mode ${mode} is invalid." + return + ;; + esac + else + mode=none + fi + ebegin " ${target} using: ${options} ${arg1} ${arg2} ${arg3}" + if [ "${mode}" = "gpg" ] ; then + : ${gpg_options:='-q -d'} + # gpg available ? + if type -p gpg >/dev/null ; then + for i in 0 1 2 ; do + # paranoid, don't store key in a variable, pipe it so it stays very little in ram unprotected. + # save stdin stdout stderr "values" + gpg ${gpg_options} ${key} 2>/dev/null | cryptsetup ${options} ${arg1} ${arg2} ${arg3} + ret=$? + [ ${ret} -eq 0 ] && break + done + eend ${ret} "failure running cryptsetup" + else + ewarn "${source} will not be decrypted ..." + einfo "Reason: cannot find gpg application." + einfo "You have to install app-crypt/gnupg first." + einfo "If you have /usr on its own partition, try copying gpg to /bin ." + fi + else + if [ "${mode}" = "reg" ] ; then + cryptsetup ${options} -d ${key} ${arg1} ${arg2} ${arg3} + ret=$? + eend ${ret} "failure running cryptsetup" + else + cryptsetup ${options} ${arg1} ${arg2} ${arg3} + ret=$? + eend ${ret} "failure running cryptsetup" + fi + fi + if [ -d "${mntrem}" ] ; then + umount -n ${mntrem} 2>/dev/null >/dev/null + rmdir ${mntrem} 2>/dev/null >/dev/null + fi + splash svc_input_end ${SVCNAME} >/dev/null 2>&1 + + if [ ${ret} -ne 0 ] ; then + cryptfs_status=1 + else + if [ -n "${pre_mount}" ] ; then + dev="/dev/mapper/${target}" + ebegin " pre_mount: ${pre_mount}" + eval "${pre_mount}" > /dev/null + ewend $? || cryptfs_status=1 + fi + fi +} + +# Run any post_mount commands for an individual mount +# +# Note: This relies on variables localized in the main body below. +dm_crypt_execute_localmount() { + local mount_point + + [ -z "${target}" ] && [ -z "${post_mount}" ] && return + + if ! cryptsetup status ${target} | egrep -q '\<active:' ; then + ewarn "Skipping unmapped target ${target}" + cryptfs_status=1 + return + fi + + mount_point=$(grep "/dev/mapper/${target}" /proc/mounts | cut -d' ' -f2) + if [ -z "${mount_point}" ] ; then + ewarn "Failed to find mount point for ${target}, skipping" + cryptfs_status=1 + fi + + if [ -n "${post_mount}" ] ; then + ebegin "Running post_mount commands for target ${target}" + eval "${post_mount}" >/dev/null + eend $? || cryptfs_status=1 + fi +} + +# Lookup optional bootparams +get_bootparam_val() { + # We're given something like: + # foo=bar=cow + # Return the "bar=cow" part. + case $1 in + *\=*) + local key=$(echo "$1" | cut -f1 -d=) + echo "$1" | cut -c $(( ${#key} + 2 )) + ;; + esac +} + +start() { + local header=true cryptfs_status=0 + local gpg_options key loop_file target targetline options pre_mount post_mount source swap remdev + + local x + for x in $(cat /proc/cmdline) ; do + case "${x}" in + key_timeout\=*) + local KEY_TIMEOUT=$(get_bootparam_val "${x}") + if [ ${KEY_TIMEOUT} -gt 0 ] ; then + read_timeout="-t ${KEY_TIMEOUT}" + fi + ;; + esac + done + + while read -u 3 targetline ; do + case ${targetline} in + # skip comments and blank lines + ""|"#"*) continue ;; + # skip service-specific openrc configs #377927 + rc_*) continue ;; + esac + + ${header} && ebegin "Setting up dm-crypt mappings" + header=false + + # check for the start of a new target/swap + case ${targetline} in + target=*|swap=*) + # If we have a target queued up, then execute it + ${execute_hook} + + # Prepare for the next target/swap by resetting variables + unset gpg_options key loop_file target options pre_mount post_mount source swap remdev + ;; + + gpg_options=*|remdev=*|key=*|loop_file=*|options=*|pre_mount=*|post_mount=*|source=*) + if [ -z "${target}${swap}" ] ; then + ewarn "Ignoring setting outside target/swap section: ${targetline}" + continue + fi + ;; + + dmcrypt_max_timeout=*) + # ignore global options + continue + ;; + + *) + ewarn "Skipping invalid line in ${conf_file}: ${targetline}" + ;; + esac + + # Queue this setting for the next call to dm_crypt_execute_xxx + eval "${targetline}" + done 3< ${conf_file} + + # If we have a target queued up, then execute it + ${execute_hook} + + ewend ${cryptfs_status} "Failed to setup dm-crypt devices" +} + +stop() { + local line header + + # Break down all mappings + header=true + egrep "^(target|swap)=" ${conf_file} | \ + while read line ; do + ${header} && einfo "Removing dm-crypt mappings" + header=false + + target= swap= + eval ${line} + + [ -n "${swap}" ] && target=${swap} + if [ -z "${target}" ] ; then + ewarn "invalid line in ${conf_file}: ${line}" + continue + fi + + ebegin " ${target}" + cryptsetup remove ${target} + eend $? + done + + # Break down loop devices + header=true + grep '^source=./dev/loop' ${conf_file} | \ + while read line ; do + ${header} && einfo "Detaching dm-crypt loop devices" + header=false + + source= + eval ${line} + + ebegin " ${source}" + losetup -d "${source}" + eend $? + done + + return 0 +} diff --git a/pcr/openrc-base/PKGBUILD b/pcr/openrc-base/PKGBUILD new file mode 100644 index 000000000..9519fb572 --- /dev/null +++ b/pcr/openrc-base/PKGBUILD @@ -0,0 +1,269 @@ +# Maintainer : freaj <freaj@riseup.net> +# Maintainer (Manjaro): artoo <artoo@manjaro.org> + +_Icron1=cronie-1.3-initd +_Icron2=anacron-1.0-initd +_Ccrypt=1.0.6-dmcrypt.confd +_Icrypt=1.5.1-dmcrypt.rc +_Idbus=dbus.initd +_Inscd=nscd +_Cdm=device-mapper.conf-1.02.22-r3 +_Idm1=device-mapper.rc-2.02.105-r2 +_Idm2=dmeventd.initd-2.02.67-r1 +_Clvm=lvm.confd-2.02.28-r2 +_Ilvm1=lvm.rc-2.02.105-r2 +_Ilvm2=lvm-monitoring.initd-2.02.105-r2 +_Ilvm3=lvmetad.initd-2.02.105-r2 +_Cmdadm=mdadm.confd +_Imdadm=mdadm.rc +_Idhcpcd=dhcpcd.initd +_Cmdraid=mdraid.confd +_Imdraid=mdraid.rc +_Ieudev=udev-postmount + +_gentoo_uri="http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86" + + +# set false if you want building without eudev(leaving systemd) +_is_eudev=true + +pkgbase=openrc-base +_pkgname=('cronie-openrc' + 'cryptsetup-openrc' + 'dbus-openrc' + 'dhcpcd-openrc' + 'device-mapper-openrc' + 'glibc-openrc' + 'inetutils-openrc' + 'lvm2-openrc' + 'mdadm-openrc') +if ${_is_eudev};then + pkgname=( ${_pkgname[@]} 'eudev-openrc') +else + pkgname=( ${_pkgname[@]} ) +fi +pkgver=20150215 +pkgrel=1 +pkgdesc="OpenRC init scripts" +arch=('any') +url="https://github.com/manjaro/packages-openrc" +license=('GPL2') +groups=('openrc' 'openrc-base') +conflicts=('initscripts' + 'systemd-sysvcompat' + 'openrc' + 'openrc-git' + 'openrc-sysvinit') +source=("${_gentoo_uri}/sys-process/cronie/files/${_Icron1}" + "${_gentoo_uri}/sys-process/cronie/files/${_Icron2}" + "${_gentoo_uri}/sys-fs/cryptsetup/files/${_Ccrypt}" + "${_gentoo_uri}/sys-fs/cryptsetup/files/${_Icrypt}" + "${_gentoo_uri}/sys-apps/dbus/files/${_Idbus}" + "${_gentoo_uri}/sys-libs/glibc/files/${_Inscd}" + "${_gentoo_uri}/sys-fs/lvm2/files/${_Cdm}" + "${_gentoo_uri}/sys-fs/lvm2/files/${_Idm1}" + "${_gentoo_uri}/sys-fs/lvm2/files/${_Idm2}" + "${_gentoo_uri}/sys-fs/lvm2/files/${_Clvm}" + "${_gentoo_uri}/sys-fs/lvm2/files/${_Ilvm1}" + "${_gentoo_uri}/sys-fs/lvm2/files/${_Ilvm2}" + "${_gentoo_uri}/sys-fs/lvm2/files/${_Ilvm3}" + "${_gentoo_uri}/sys-fs/mdadm/files/${_Cmdadm}" + "${_gentoo_uri}/sys-fs/mdadm/files/${_Imdadm}" + "${_gentoo_uri}/sys-fs/mdadm/files/${_Cmdraid}" + "${_gentoo_uri}/sys-fs/mdadm/files/${_Imdraid}" + "${_gentoo_uri}/net-misc/dhcpcd/files/${_Idhcpcd}" + "${_gentoo_uri}/sys-fs/eudev/files/${_Ieudev}" + 'inetutils.confd' + 'inetutils.initd') + +_shebang='s|#!/sbin/runscript|#!/usr/bin/openrc-run|' +_runpath='s|/var/run|/run|g' +_binpath=('s|/usr/sbin|/usr/bin|g' 's|/sbin|/usr/bin|g') + +pkgver() { + date +%Y%m%d +} + +package_cronie-openrc() { + pkgdesc="OpenRC cronie init script" + groups=('openrc' 'openrc-base' 'openrc-desktop') + depends=('openrc-core' 'cronie') + provides=('openrc-cron') + conflicts=('fcron' + 'fcron-openrc' + 'openrc' + 'openrc-git' + 'openrc-arch-services-git' + 'initscripts' + 'systemd-sysvcompat') + backup=('etc/init.d/cronie') + install=cronie.install + + install -Dm755 "${srcdir}/${_Icron1}" "${pkgdir}/etc/init.d/cronie" + install -Dm755 "${srcdir}/${_Icron2}" "${pkgdir}/etc/init.d/anacron" + + for f in ${pkgdir}/etc/init.d/*; do + sed -e "${_shebang}" \ + -e "${_binpath[0]}" \ + -e "${_runpath}" \ + -i $f + done +} + +package_dhcpcd-openrc() { + pkgdesc="OpenRC dhcpcd init script" + groups=('openrc' 'openrc-base' 'openrc-desktop') + depends=('openrc-core' 'dhcpcd') + install=dhcpcd.install + + install -Dm755 "${srcdir}/${_Idhcpcd}" "${pkgdir}/etc/init.d/dhcpcd" + + sed -e "${_shebang}" \ + -e "${_binpath[1]}" \ + -e "${_runpath}" \ + -i "${pkgdir}/etc/init.d/dhcpcd" +} + +package_dbus-openrc() { + pkgdesc="OpenRC dbus init script" + groups=('openrc' 'openrc-base' 'openrc-desktop') + depends=('openrc-core' 'dbus') + install=dbus.install + + install -Dm755 "${srcdir}/${_Idbus}" "${pkgdir}/etc/init.d/dbus" + + local _p1='s|dbus.pid|dbus/pid|g' + sed -e "${_shebang}" -e "${_runpath}" \ + -e "${_p1}" \ + -i "${pkgdir}/etc/init.d/dbus" +} + +package_device-mapper-openrc() { + pkgdesc="OpenRC device-mapper init script" + depends=('openrc-core' 'device-mapper') + backup=('etc/conf.d/device-mapper') + install=device-mapper.install + + install -Dm755 "${srcdir}/${_Cdm}" "${pkgdir}/etc/conf.d/device-mapper" + install -Dm755 "${srcdir}/${_Idm1}" "${pkgdir}/etc/init.d/device-mapper" + install -Dm755 "${srcdir}/${_Idm2}" "${pkgdir}/etc/init.d/dmeventd" + + for f in ${pkgdir}/etc/init.d/*; do + sed -e "${_shebang}" \ + -e "${_binpath[1]}" \ + -e "${_runpath}" \ + -i $f + done +} + +package_cryptsetup-openrc() { + pkgdesc="OpenRC cryptsetup init script" + depends=('device-mapper-openrc' 'cryptsetup') + backup=('etc/conf.d/dmcrypt') + install=cryptsetup.install + + install -Dm755 "${srcdir}/${_Ccrypt}" "${pkgdir}/etc/conf.d/dmcrypt" + install -Dm755 "${srcdir}/${_Icrypt}" "${pkgdir}/etc/init.d/dmcrypt" + + sed -e "${_shebang}" \ + -e "${_binpath[0]}" \ + -e "${_runpath}" \ + -i "${pkgdir}/etc/init.d/dmcrypt" +} + +package_glibc-openrc() { + pkgdesc="OpenRC nscd init script" + depends=('openrc-core' 'glibc') + optdepends=('openldap-openrc' + 'bind-openrc') + install=glibc.install + + install -Dm755 "${srcdir}/${_Inscd}" "${pkgdir}/etc/init.d/nscd" + + sed -e "${_shebang}" \ + -e "${_binpath[0]}" \ + -e "${_runpath}" \ + -i "${pkgdir}/etc/init.d/nscd" +} + +package_inetutils-openrc() { + pkgdesc="OpenRC ftpd init script" + depends=('openrc-core' 'inetutils') + backup=('etc/conf.d/ftpd') + install=inetutils.install + + install -Dm755 "${srcdir}/inetutils.confd" "${pkgdir}/etc/conf.d/ftpd" + install -Dm755 "${srcdir}/inetutils.initd" "${pkgdir}/etc/init.d/ftpd" +} + +package_lvm2-openrc() { + pkgdesc="OpenRC lvm2 init script" + depends=('device-mapper-openrc' 'lvm2') + backup=('etc/conf.d/lvm') + install=lvm2.install + + install -Dm755 "${srcdir}/${_Clvm}" "${pkgdir}/etc/conf.d/lvm" + install -Dm755 "${srcdir}/${_Ilvm1}" "${pkgdir}/etc/init.d/lvm" + install -Dm755 "${srcdir}/${_Ilvm2}" "${pkgdir}/etc/init.d/lvm-monitoring" + install -Dm755 "${srcdir}/${_Ilvm3}" "${pkgdir}/etc/init.d/lvmetad" + + for f in ${pkgdir}/etc/init.d/*; do + sed -e "${_shebang}" \ + -e "${_binpath[1]}" \ + -e "${_runpath}" \ + -i $f + done +} + +package_mdadm-openrc() { + pkgdesc="OpenRC mdadm init script" + depends=('openrc-core' 'mdadm') + optdepends=('bind-openrc') + backup=('etc/conf.d/mdadm') + install=mdadm.install + + install -Dm755 "${srcdir}/${_Cmdadm}" "${pkgdir}/etc/conf.d/mdadm" + install -Dm755 "${srcdir}/${_Imdadm}" "${pkgdir}/etc/init.d/mdadm" + + install -Dm755 "${srcdir}/${_Cmdraid}" "${pkgdir}/etc/conf.d/mdraid" + install -Dm755 "${srcdir}/${_Imdraid}" "${pkgdir}/etc/init.d/mdraid" + + sed -e "${_shebang}" \ + -e "${_runpath}" \ + -i "${pkgdir}/etc/init.d/mdadm" + sed -e "${_shebang}" \ + -i "${pkgdir}/etc/init.d/mdraid" +} + +package_eudev-openrc(){ + pkgdesc="OpenRC eudev postmount script" + groups=('eudev-base') + depends=('openrc-core' 'eudev') + install=eudev.install + + install -Dm755 "${srcdir}/${_Ieudev}" "${pkgdir}/etc/init.d/udev-postmount" + + sed -e "${_shebang}" -i "${pkgdir}/etc/init.d/udev-postmount" +} + +sha256sums=('292a7b20fe33bd027357475fea6aa1194afa7e5c1c47a85299db945b9d1c847e' + '7ff283ee8b492929d33831461b72e872fe9d3a98344cf39af442f575875b0132' + '9696d70a49296113a9ae3dff1b023b859df984bfb3572426ba199a630b628ce8' + '1010666cfb3cd2c662032c3e8f3c2aec35316fc376d0ce30f2c821b581ae2c6d' + '98e37b8b6ed25004e48c5855d74c9361eea06d3fee13cefcc0ed10ccf452aa01' + '6165db3a2fcb251d4f3655c0461e018ce9c92a37f7f22a8fd2b75178b5435bc8' + '57777904f12a35617e5a4193c964ebb32396452487fd02353e71e16e7b46bc22' + '036b6de05e6cbd921a667d6fc6b01d30c8f9b720e1a0d0e2453ecd62d32573fb' + '0c051388991ba69afbf2f6baf36ba227d7c26fc8f0d7588d8de76d9a74886d79' + '28370c089c39c248d7ded0960b8d8a9256bada44d44c22ce3cec87d512ef6844' + 'a5754ffa0a05a0c29a9f6b5acf1b21dd313581fd6156c1ef722dc620e0114676' + 'd7655cadd3a3a9d3683a540413365310ca9503c38fd21a9bfccec40630ca72f1' + '60accb4b6114753232f2db0adf3fc3f46d4459bfedf79b888801a13c55d79fa9' + 'ec55674955af7a31da51b8b72b599e8519809287dad796a9b16155bcba471b79' + '3073b14619cb7b2c99c33f2d6cfd1e59ce5557899bffebaa65fa52f3caffadc7' + '1b7918c4bdd024607bcb49d7cea0a77cb70502d2fbb4dbe07024bb5b5699c8e0' + '73303ec32b7010c7f6d4fd66dde1a5baea07e73c79d3e516dce31000abdb4089' + '72b42c9939fda3fb56666813513029ed36194c1708bddce06bcb3e131e547492' + '0220e949b1f31832a205021c0a8615e77b27b73b7c9b16ef4a61bbd2774aeecb' + '59fe1aa68c43f4958afc397a0d6b35da263a20fcdb457005123a0d64cb1f7477' + '7f46e5e9ac9f204fb1564560c506a5bb4cede8823b89e3f1844e4f8be258e9ef') diff --git a/pcr/openrc-base/anacron-1.0-initd b/pcr/openrc-base/anacron-1.0-initd new file mode 100644 index 000000000..6462b900e --- /dev/null +++ b/pcr/openrc-base/anacron-1.0-initd @@ -0,0 +1,18 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-process/cronie/files/anacron-1.0-initd,v 1.4 2014/03/04 00:17:58 polynomial-c Exp $ + +# anacron forks itself when -d gets omitted. So s-s-d fails to create a valid +# pidfile. DO NOT remove -d from command_args and let s-s-d start anacron +# in background! + +command="/usr/sbin/anacron" +command_args="-d -s -S /var/spool/anacron" +pidfile="/var/run/anacron.pid" +command_background="true" + +depend() { + use clock logger + need localmount +} diff --git a/pcr/openrc-base/cronie-1.3-initd b/pcr/openrc-base/cronie-1.3-initd new file mode 100644 index 000000000..138530f5e --- /dev/null +++ b/pcr/openrc-base/cronie-1.3-initd @@ -0,0 +1,14 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-process/cronie/files/cronie-1.3-initd,v 1.3 2014/03/04 00:17:58 polynomial-c Exp $ + +command="/usr/sbin/crond" +command_args="${CRONDARGS}" +pidfile="/var/run/crond.pid" + +depend() { + use clock logger + need localmount + provide cron +} diff --git a/pcr/openrc-base/cronie.install b/pcr/openrc-base/cronie.install new file mode 100644 index 000000000..aa2454c36 --- /dev/null +++ b/pcr/openrc-base/cronie.install @@ -0,0 +1,16 @@ +_svc="cronie" +_rlvl="default" + +post_install() { + _cmd="rc-update add ${_svc} ${_rlvl}" + echo " ==> run '${_cmd}'" +} + +post_upgrade() { + post_install "$1" +} + +post_remove() { + _cmd="rc-update del ${_svc} ${_rlvl}" + echo " ==> run '${_cmd}'" +} diff --git a/pcr/openrc-base/cryptsetup.install b/pcr/openrc-base/cryptsetup.install new file mode 100644 index 000000000..edbb2dd26 --- /dev/null +++ b/pcr/openrc-base/cryptsetup.install @@ -0,0 +1,16 @@ +_svc="dmcrypt" +_rlvl="boot" + +post_install() { + _cmd="rc-update add ${_svc} ${_rlvl}" + echo " ==> run '${_cmd}'" +} + +post_upgrade() { + post_install "$1" +} + +post_remove() { + _cmd="rc-update del ${_svc} ${_rlvl}" + echo " ==> run '${_cmd}'" +} diff --git a/pcr/openrc-base/dbus.initd b/pcr/openrc-base/dbus.initd new file mode 100644 index 000000000..65271f69c --- /dev/null +++ b/pcr/openrc-base/dbus.initd @@ -0,0 +1,50 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/sys-apps/dbus/files/dbus.initd,v 1.1 2011/11/05 13:56:10 ssuominen Exp $ + +extra_started_commands="reload" + +depend() { + need localmount + after bootmisc +} + +start() { + ebegin "Starting D-BUS system messagebus" + /usr/bin/dbus-uuidgen --ensure=/etc/machine-id + + # We need to test if /var/run/dbus exists, since script will fail if it does not + [ ! -e /var/run/dbus ] && mkdir /var/run/dbus + + start-stop-daemon --start --pidfile /var/run/dbus.pid --exec /usr/bin/dbus-daemon -- --system + eend $? +} + +stop() { + local retval + + ebegin "Stopping D-BUS system messagebus" + + start-stop-daemon --stop --pidfile /var/run/dbus.pid + retval=$? + + eend ${retval} + + [ -S /var/run/dbus/system_bus_socket ] && rm -f /var/run/dbus/system_bus_socket + + return ${retval} +} + +reload() { + local retval + + ebegin "Reloading D-BUS messagebus config" + + /usr/bin/dbus-send --print-reply --system --type=method_call \ + --dest=org.freedesktop.DBus \ + / org.freedesktop.DBus.ReloadConfig > /dev/null + retval=$? + eend ${retval} + return ${retval} +} diff --git a/pcr/openrc-base/dbus.install b/pcr/openrc-base/dbus.install new file mode 100644 index 000000000..f93bc37ca --- /dev/null +++ b/pcr/openrc-base/dbus.install @@ -0,0 +1,16 @@ +_svc="dbus" +_rlvl="default" + +post_install() { + _cmd="rc-update add ${_svc} ${_rlvl}" + echo " ==> run '${_cmd}'" +} + +post_upgrade() { + post_install "$1" +} + +post_remove() { + _cmd="rc-update del ${_svc} ${_rlvl}" + echo " ==> run '${_cmd}'" +} diff --git a/pcr/openrc-base/device-mapper.conf-1.02.22-r3 b/pcr/openrc-base/device-mapper.conf-1.02.22-r3 new file mode 100644 index 000000000..bc7a25158 --- /dev/null +++ b/pcr/openrc-base/device-mapper.conf-1.02.22-r3 @@ -0,0 +1 @@ +RC_AFTER="lvm" diff --git a/pcr/openrc-base/device-mapper.install b/pcr/openrc-base/device-mapper.install new file mode 100644 index 000000000..f2429ddb9 --- /dev/null +++ b/pcr/openrc-base/device-mapper.install @@ -0,0 +1,20 @@ +_svc=('device-mapper' 'dmeventd') +_rlvl="boot" + +post_install() { + _cmd="rc-update add ${_svc[0]} ${_rlvl}" + echo " ==> run '${_cmd}'" + _cmd="rc-update add ${_svc[1]} ${_rlvl}" + echo " ==> run '${_cmd}'" +} + +post_upgrade() { + post_install "$1" +} + +post_remove() { + _cmd="rc-update del ${_svc[0]} ${_rlvl}" + echo " ==> run '${_cmd}'" + _cmd="rc-update del ${_svc[1]} ${_rlvl}" + echo " ==> run '${_cmd}'" +} diff --git a/pcr/openrc-base/device-mapper.rc-2.02.105-r2 b/pcr/openrc-base/device-mapper.rc-2.02.105-r2 new file mode 100644 index 000000000..56e75037e --- /dev/null +++ b/pcr/openrc-base/device-mapper.rc-2.02.105-r2 @@ -0,0 +1,147 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/device-mapper.rc-2.02.105-r2,v 1.1 2014/02/02 19:52:34 robbat2 Exp $ + +depend() { + # As of .67-r1, we call ALL lvm start/stop scripts with --sysinit, that + # means dmeventd is NOT notified, as it cannot be safely running + before dmeventd checkfs fsck + after modules +} + +dm_in_proc() { + local retval=0 + for x in devices misc ; do + grep -qs 'device-mapper' /proc/${x} + retval=$((${retval} + $?)) + done + return ${retval} +} + +# char **build_dmsetup_command(volume) +# +# Returns complete dmsetup command given single volume name +build_dmsetup_command() { + local count dmsetup_cmd + + # Number of lines mentioning volume name + count=$(grep -v -e '^[[:space:]]*\(#\|$\)' /etc/dmtab | grep -c ${1}) + + # If there's just one line: + if [ ${count} -eq 1 ] ; then + echo "echo $(grep -v -e '^[[:space:]]*\(#\|$\)' /etc/dmtab | \ + grep ${1} | awk '{$1=""; print $0}') | /sbin/dmsetup create ${1}" + + # For all cases with more lines: + elif [ ${count} -gt 1 ] ; then + for c in $( seq 1 ${count} ) ; do + if [ ${c} -eq 1 ] ; then + # Heavy escaping in awk-statement because we cannot use apostrophes + dmsetup_cmd="echo -e $(grep -v -e '^[[:space:]]*\(#\|$\)' /etc/dmtab | \ + grep ${1} | awk NR==${c}\ \{\$1=\"\"\;\ print\ \$0\})" + else + # Append starting with newline + dmsetup_cmd="${dmsetup_cmd}\\\\n \ + $(grep -v -e '^[[:space:]]*\(#\|$\)' /etc/dmtab | \ + grep ${1} | awk NR==${c}\ \{\$1=\"\"\;\ print\ \$0\})" + fi + done + echo "${dmsetup_cmd} | /sbin/dmsetup create ${1}" + fi + + return 0 +} + +# char **get_new_dm_volumes(void) +# +# Return unique volumes from /etc/dmtab +get_new_dm_volumes() { + local volume + + # Filter comments and blank lines + grep -v -e '^[[:space:]]*\(#\|$\)' /etc/dmtab | \ + awk '{ print $1 }' | \ + uniq | \ + while read volume ; do + # If it exists, skip it + dmvolume_exists "${volume%:}" && continue + + echo "${volume%:}" + done + + return 0 +} + +# int dmvolume_exists(volume) +# +# Return true if volume exists in DM table +dmvolume_exists() { + local x line volume=$1 + + [ -z "${volume}" ] && return 1 + + /sbin/dmsetup ls 2>/dev/null | \ + while read line ; do + for x in ${line} ; do + # the following conditonal return only breaks out + # of the while loop, as it is running in a pipe. + [ "${x}" = "${volume}" ] && return 1 + # We only want to check the volume name + break + done + done + + # if 1 was returned from the above loop, then indicate that + # volume exists + [ $? = 1 ] && return 0 + + # otherwise the loop exited normally and the volume does not + # exist + return 1 +} + +# int is_empty_dm_volume(volume) +# +# Return true if the volume exists in DM table, but is empty/non-valid +is_empty_dm_volume() { + local table volume=$1 + + set -- $(/sbin/dmsetup table 2>/dev/null | grep -e "^${volume}:") + [ "${volume}" = "$1" -a -z "$2" ] +} + + +start() { + if [ -e /proc/modules ] && ! dm_in_proc ; then + modprobe dm-mod 2>/dev/null + fi + # Ensure the dirs exist for locking and running + checkpath -q -d -m 0700 -o root:root /run/lvm /run/lock/lvm + + local x volume + + if [ -x /sbin/dmsetup -a -c /dev/mapper/control -a -f /etc/dmtab ] ; then + [ -n "$(get_new_dm_volumes)" ] && \ + einfo " Setting up device-mapper volumes:" + + get_new_dm_volumes | \ + while read x ; do + [ -n "${x}" ] || continue + + volume="${x##* }" + + ebegin " Creating volume: ${volume}" + if ! eval $(build_dmsetup_command ${volume}) >/dev/null 2>/dev/null ; then + eend 1 " Error creating volume: ${volume}" + # dmsetup still adds an empty volume in some cases, + # so lets remove it + is_empty_dm_volume "${volume}" && \ + /sbin/dmsetup remove "${volume}" 2>/dev/null + else + eend 0 + fi + done + fi +} + diff --git a/pcr/openrc-base/dhcpcd.initd b/pcr/openrc-base/dhcpcd.initd new file mode 100644 index 000000000..d88b0610d --- /dev/null +++ b/pcr/openrc-base/dhcpcd.initd @@ -0,0 +1,17 @@ +#!/sbin/runscript +# Copyright 2007-2008 Roy Marples <roy@marples.name> +# All rights reserved. Released under the 2-clause BSD license. + +command=/sbin/dhcpcd +pidfile=/var/run/dhcpcd.pid +command_args=-q +name="DHCP Client Daemon" + +depend() +{ + provide net + need localmount + use logger network + after bootmisc modules + before dns +} diff --git a/pcr/openrc-base/dhcpcd.install b/pcr/openrc-base/dhcpcd.install new file mode 100644 index 000000000..278467b94 --- /dev/null +++ b/pcr/openrc-base/dhcpcd.install @@ -0,0 +1,16 @@ +_svc="dhcpcd" +_rlvl="default" + +post_install() { + _cmd="rc-update add ${_svc} ${_rlvl}" + echo " ==> run '${_cmd}'" +} + +post_upgrade() { + post_install "$1" +} + +post_remove() { + _cmd="rc-update del ${_svc} ${_rlvl}" + echo " ==> run '${_cmd}'" +} diff --git a/pcr/openrc-base/dmeventd.initd-2.02.67-r1 b/pcr/openrc-base/dmeventd.initd-2.02.67-r1 new file mode 100644 index 000000000..3c2f5f327 --- /dev/null +++ b/pcr/openrc-base/dmeventd.initd-2.02.67-r1 @@ -0,0 +1,26 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/dmeventd.initd-2.02.67-r1,v 1.3 2014/02/08 21:17:46 robbat2 Exp $ + +PIDFILE=/run/dmeventd.pid +BIN=/sbin/dmeventd + +depend() { + # As of .67-r1, we call ALL lvm start/stop scripts with --sysinit, that + # means dmeventd is NOT notified, as it cannot be safely running + after lvm device-mapper +} + +start() { + ebegin "Starting dmeventd" + start-stop-daemon --start --exec $BIN --pidfile $PIDFILE + eend $? +} + +stop() { + ebegin "Stopping dmeventd" + start-stop-daemon --stop --exec $BIN --pidfile $PIDFILE + eend $? +} + diff --git a/pcr/openrc-base/eudev.install b/pcr/openrc-base/eudev.install new file mode 100644 index 000000000..0043774fa --- /dev/null +++ b/pcr/openrc-base/eudev.install @@ -0,0 +1,14 @@ +_svc="udev-postmount" +_rlvl="default" + +post_install() { + rc-update add ${_svc} ${_rlvl} +} + +post_upgrade() { + post_install "$1" +} + +pre_remove() { + rc-update del ${_svc} ${_rlvl} +} diff --git a/pcr/openrc-base/glibc.install b/pcr/openrc-base/glibc.install new file mode 100644 index 000000000..eed830c26 --- /dev/null +++ b/pcr/openrc-base/glibc.install @@ -0,0 +1,16 @@ +_svc="nscd" +_rlvl="default" + +post_install() { + _cmd="rc-update add ${_svc} ${_rlvl}" + echo " ==> run '${_cmd}'" +} + +post_upgrade() { + post_install "$1" +} + +post_remove() { + _cmd="rc-update del ${_svc} ${_rlvl}" + echo " ==> run '${_cmd}'" +} diff --git a/pcr/openrc-base/inetutils.confd b/pcr/openrc-base/inetutils.confd new file mode 100644 index 000000000..df58eab46 --- /dev/null +++ b/pcr/openrc-base/inetutils.confd @@ -0,0 +1,8 @@ +# +# Parameters to be passed to ftpd +# +FTPD_ARGS="-D" + +# Neeed for openrc newnet +#current openrc4arch packages are compiled with oldnet +#rc_need=\"!net\" diff --git a/pcr/openrc-base/inetutils.initd b/pcr/openrc-base/inetutils.initd new file mode 100644 index 000000000..a53184c4c --- /dev/null +++ b/pcr/openrc-base/inetutils.initd @@ -0,0 +1,27 @@ +#!/usr/bin/openrc-run +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +FTPD_BINARY="/usr/bin/ftpd" +FTPD_PIDFILE="/run/ftpd.pid" + +depend() { + use logger dns + need net +} + +start() { + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --exec "${FTPD_BINARY}" \ + --pidfile "${FTPD_PIDFILE}" \ + -- ${FTPD_ARGS} + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --exec "${FTPD_BINARY}" \ + --pidfile "${FTPD_PIDFILE}" --quiet + eend $? +} + diff --git a/pcr/openrc-base/inetutils.install b/pcr/openrc-base/inetutils.install new file mode 100644 index 000000000..85b4fad7a --- /dev/null +++ b/pcr/openrc-base/inetutils.install @@ -0,0 +1,16 @@ +_svc="ftpd" +_rlvl="default" + +post_install() { + _cmd="rc-update add ${_svc} ${_rlvl}" + echo " ==> run '${_cmd}'" +} + +post_upgrade() { + post_install "$1" +} + +post_remove() { + _cmd="rc-update del ${_svc} ${_rlvl}" + echo " ==> run '${_cmd}'" +} diff --git a/pcr/openrc-base/lvm-monitoring.initd-2.02.105-r2 b/pcr/openrc-base/lvm-monitoring.initd-2.02.105-r2 new file mode 100644 index 000000000..c53a60465 --- /dev/null +++ b/pcr/openrc-base/lvm-monitoring.initd-2.02.105-r2 @@ -0,0 +1,39 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm-monitoring.initd-2.02.105-r2,v 1.1 2014/02/02 19:52:34 robbat2 Exp $ + +# This script is based on upstream file +# LVM2.2.02.67/scripts/lvm2_monitoring_init_red_hat.in + +depend() { + # As of .67-r1, we call ALL lvm start/stop scripts with --sysinit, that + # means dmeventd is NOT notified, as it cannot be safely running + need lvm dmeventd +} + +VGCHANGE=/sbin/vgchange +VGS=/sbin/vgs + +start() { + ret=0 + # TODO do we want to separate out already active groups only? + VGSLIST=`$VGS --noheadings -o name --rows 2> /dev/null` + ebegin "Starting LVM monitoring for VGs ${VGSLIST}:" + $VGCHANGE --monitor y --poll y ${VGSLIST} + ret=$? + eend $ret + return $ret + +} + +stop() { + ret=0 + # TODO do we want to separate out already active groups only? + VGSLIST=`$VGS --noheadings -o name --rows 2> /dev/null` + ebegin "Stopping LVM monitoring for VGs ${VGSLIST}:" + $VGCHANGE --monitor n ${VGSLIST} + ret=$? + eend $ret + return $ret +} diff --git a/pcr/openrc-base/lvm.confd-2.02.28-r2 b/pcr/openrc-base/lvm.confd-2.02.28-r2 new file mode 100644 index 000000000..2fbd8668c --- /dev/null +++ b/pcr/openrc-base/lvm.confd-2.02.28-r2 @@ -0,0 +1,5 @@ +# LVM should normally only be started after mdraid is available +# this is because LVM physical volumes are very often MD devices. +RC_AFTER="mdraid" + +# vim: ft=gentoo-conf-d diff --git a/pcr/openrc-base/lvm.rc-2.02.105-r2 b/pcr/openrc-base/lvm.rc-2.02.105-r2 new file mode 100644 index 000000000..7fdf50e18 --- /dev/null +++ b/pcr/openrc-base/lvm.rc-2.02.105-r2 @@ -0,0 +1,97 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm.rc-2.02.105-r2,v 1.1 2014/02/02 19:52:34 robbat2 Exp $ + +depend() { + before checkfs fsck + after modules device-mapper + need lvmetad sysfs +} + +config='global { locking_dir = "/run/lock/lvm" }' + +dm_in_proc() { + local retval=0 + for x in devices misc ; do + grep -qs 'device-mapper' /proc/${x} + retval=$((${retval} + $?)) + done + return ${retval} +} + +start() { + # LVM support for /usr, /home, /opt .... + # This should be done *before* checking local + # volumes, or they never get checked. + + # NOTE: Add needed modules for LVM or RAID, etc + # to /etc/modules.autoload if needed + for lvm_path in /bin/lvm /sbin/lvm ; do + [ -x "$lvm_path" ] && break + done + if [ ! -x "$lvm_path" ]; then + eerror "Cannot find lvm binary in /sbin or /bin!" + return 1 + fi + if [ -z "${CDBOOT}" ] ; then + if [ -e /proc/modules ] && ! dm_in_proc ; then + modprobe dm-mod 2>/dev/null + fi + if [ -d /proc/lvm ] || dm_in_proc ; then + ebegin "Setting up the Logical Volume Manager" + #still echo stderr for debugging + lvm_commands="#! ${lvm_path} --config '${config}'\n" + # Extra PV find pass because some devices might not have been available until very recently + lvm_commands="${lvm_commands}pvscan\n" + # Now make the nodes + lvm_commands="${lvm_commands}vgscan --mknodes\n" + # And turn them on! + lvm_commands="${lvm_commands}vgchange --sysinit -a ly\n" + # Order of this is important, have to work around dash and LVM readline + printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0 --config "${config}" >/dev/null + eend $? "Failed to setup the LVM" + fi + fi +} + +stop() { + for lvm_path in /bin/lvm /sbin/lvm ; do + [ -x "$lvm_path" ] && break + done + if [ ! -x "$lvm_path" ]; then + eerror "Cannot find lvm binary in /sbin or /bin!" + return 1 + fi +# Stop LVM2 +if [ -x /sbin/vgs ] && \ + [ -x /sbin/vgchange ] && \ + [ -x /sbin/lvchange ] && \ + [ -f /etc/lvmtab -o -d /etc/lvm ] && \ + [ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ] +then + einfo "Shutting down the Logical Volume Manager" + + + VGS=$($lvm_path vgs --config "${config}" -o vg_name --noheadings --nosuffix --rows 2> /dev/null) + + if [ "$VGS" ] + then + ebegin " Shutting Down LVs & VGs" + #still echo stderr for debugging + lvm_commands="#! ${lvm_path} --config '${config}'\n" + # Extra PV find pass because some devices might not have been available until very recently + lvm_commands="${lvm_commands}lvchange --sysinit -a ln ${VGS}\n" + # Now make the nodes + lvm_commands="${lvm_commands}vgchange --sysinit -a ln ${VGS}\n" + # Order of this is important, have to work around dash and LVM readline + printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0 --config "${config}" >/dev/null + eend $? "Failed (possibly some LVs still needed for /usr or root)" + fi + + einfo "Finished shutting down the Logical Volume Manager" + return 0 +fi +} + +# vim:ts=4 diff --git a/pcr/openrc-base/lvm2.install b/pcr/openrc-base/lvm2.install new file mode 100644 index 000000000..8a00d2936 --- /dev/null +++ b/pcr/openrc-base/lvm2.install @@ -0,0 +1,24 @@ +_svc=('lvm' 'lvmetad' 'lvm-monitoring') +_rlvl=('boot' 'default') + +post_install() { + _cmd="rc-update add ${_svc[0]} ${_rlvl[0]}" + echo " ==> run '${_cmd}'" +# _cmd="rc-update add ${_svc[1]} ${_rlvl[1]}" +# echo " ==> run '${_cmd}'" +# _cmd="rc-update add ${_svc[2]} ${_rlvl[1]}" +# echo " ==> run '${_cmd}'" +} + +post_upgrade() { + post_install "$1" +} + +post_remove() { + _cmd="rc-update del ${_svc[0]} ${_rlvl[0]}" + echo " ==> run '${_cmd}'" +# _cmd="rc-update del ${_svc[1]} ${_rlvl[1]}" +# echo " ==> run '${_cmd}'" +# _cmd="rc-update del ${_svc[2]} ${_rlvl[1]}" +# echo " ==> run '${_cmd}'" +} diff --git a/pcr/openrc-base/lvmetad.initd-2.02.105-r2 b/pcr/openrc-base/lvmetad.initd-2.02.105-r2 new file mode 100644 index 000000000..e16d55c46 --- /dev/null +++ b/pcr/openrc-base/lvmetad.initd-2.02.105-r2 @@ -0,0 +1,13 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvmetad.initd-2.02.105-r2,v 1.2 2014/02/08 21:17:46 robbat2 Exp $ + +pidfile="/run/lvmetad.pid" +command="/sbin/lvmetad" +command_args="${LVMETAD_OPTS:=-p ${pidfile}}" +start_stop_daemon_args="--pidfile ${pidfile}" + +depend() { + : +} diff --git a/pcr/openrc-base/mdadm.confd b/pcr/openrc-base/mdadm.confd new file mode 100644 index 000000000..a4ead14dc --- /dev/null +++ b/pcr/openrc-base/mdadm.confd @@ -0,0 +1,7 @@ +# /etc/conf.d/mdadm: config file for /etc/init.d/mdadm + +# Misc options to pass to mdadm in monitor mode. +# For more info, run `mdadm --monitor --help` or see +# the mdadm(8) manpage. + +MDADM_OPTS="--syslog" diff --git a/pcr/openrc-base/mdadm.install b/pcr/openrc-base/mdadm.install new file mode 100644 index 000000000..8bcffe5f6 --- /dev/null +++ b/pcr/openrc-base/mdadm.install @@ -0,0 +1,16 @@ +_svc="mdadm" +_rlvl="boot" + +post_install() { + _cmd="rc-update add ${_svc} ${_rlvl}" + echo " ==> run '${_cmd}'" +} + +post_upgrade() { + post_install "$1" +} + +post_remove() { + _cmd="rc-update del ${_svc} ${_rlvl}" + echo " ==> run '${_cmd}'" +} diff --git a/pcr/openrc-base/mdadm.rc b/pcr/openrc-base/mdadm.rc new file mode 100644 index 000000000..c30004d0b --- /dev/null +++ b/pcr/openrc-base/mdadm.rc @@ -0,0 +1,26 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/mdadm/files/mdadm.rc,v 1.2 2006/04/25 05:41:51 vapier Exp $ + +depend() { + use logger dns net +} + +start() { + ebegin "Starting mdadm monitor" + mdadm --monitor --scan \ + --daemonise \ + --pid-file /var/run/mdadm.pid \ + ${MDADM_OPTS} + eend $? +} + +stop() { + local ret + ebegin "Stopping mdadm monitor" + start-stop-daemon --stop --pidfile /var/run/mdadm.pid + ret=$? + rm -f /var/run/mdadm.pid + eend ${ret} +} diff --git a/pcr/openrc-base/mdraid.confd b/pcr/openrc-base/mdraid.confd new file mode 100644 index 000000000..daa17abd8 --- /dev/null +++ b/pcr/openrc-base/mdraid.confd @@ -0,0 +1,5 @@ +# /etc/conf.d/mdraid: config file for /etc/init.d/mdraid + +# For people who run raid on top of some other layer (like +# dmcrypt), use rc_need to specify that requirement. See +# the runscript(8) man page for more information. diff --git a/pcr/openrc-base/mdraid.rc b/pcr/openrc-base/mdraid.rc new file mode 100644 index 000000000..27421e26e --- /dev/null +++ b/pcr/openrc-base/mdraid.rc @@ -0,0 +1,40 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/mdadm/files/mdraid.rc,v 1.6 2011/11/12 21:06:44 vapier Exp $ + +depend() { + before checkfs fsck + after modules +} + +start() { + local output + + ebegin "Starting up RAID devices" + output=$(mdadm -As 2>&1) + eend $? "${output}" + + local pat="/dev/md_d*" + set -- ${pat} + if [ "$*" != "${pat}" ] ; then + ebegin "Creating RAID device partitions" + blockdev "$@" + eend $? + # wait because vgscan runs next, and we want udev to fire + sleep 1 + fi + + return 0 +} + +stop() { + local output + + # XXX: Maybe drop this check ? + [ ! -e /etc/mdadm/mdadm.conf ] && [ ! -e /etc/mdadm.conf ] && return 0 + + ebegin "Shutting down RAID devices (mdadm)" + output=$(mdadm -Ss 2>&1) + eend $? "${output}" +} diff --git a/pcr/openrc-base/nscd b/pcr/openrc-base/nscd new file mode 100644 index 000000000..b102de070 --- /dev/null +++ b/pcr/openrc-base/nscd @@ -0,0 +1,64 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/nscd,v 1.7 2007/02/23 12:09:39 uberlord Exp $ + +depend() { + use dns ldap net slapd +} + +checkconfig() { + if [ ! -d /var/run/nscd ] ; then + mkdir -p /var/run/nscd + chmod 755 /var/run/nscd + fi + if [ -z "${NSCD_PERMS_OK}" ] && [ "$(stat -c %a /var/run/nscd)" != "755" ] ; then + echo "" + ewarn "nscd run dir is not world readable, you should reset the perms:" + ewarn "chmod 755 /var/run/nscd" + ewarn "chmod a+rw /var/run/nscd/socket" + echo "" + ewarn "To disable this warning, set 'NSCD_PERMS_OK' in /etc/conf.d/nscd" + echo "" + fi +} + +start() { + checkconfig + + ebegin "Starting Name Service Cache Daemon" + local secure=`while read curline ; do + table=${curline%:*} + entries=${curline##$table:} + table=${table%%[^a-z]*} + case $table in + passwd*|group*|hosts) + for entry in $entries ; do + case $entry in + nisplus*) + /usr/sbin/nscd_nischeck $table || \ + /echo "-S $table,yes" + ;; + esac + done + ;; + esac + done < /etc/nsswitch.conf` + local pidfile="$(strings /usr/sbin/nscd | grep nscd.pid)" + mkdir -p "$(dirname ${pidfile})" + save_options pidfile "${pidfile}" + start-stop-daemon --start --quiet \ + --exec /usr/sbin/nscd --pidfile "${pidfile}" \ + -- $secure + eend $? +} + +stop() { + local pidfile="$(get_options pidfile)" + [ -n "${pidfile}" ] && pidfile="--pidfile ${pidfile}" + ebegin "Shutting down Name Service Cache Daemon" + start-stop-daemon --stop --quiet --exec /usr/sbin/nscd ${pidfile} + eend $? +} + +# vim:ts=4 diff --git a/pcr/openrc-base/udev-postmount b/pcr/openrc-base/udev-postmount new file mode 100644 index 000000000..e433736db --- /dev/null +++ b/pcr/openrc-base/udev-postmount @@ -0,0 +1,55 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() +{ + need localmount + keyword -vserver -lxc +} + +dir_writeable() +{ + touch "$1"/.test.$$ 2>/dev/null && rm "$1"/.test.$$ +} + +# store persistent-rules that got created while booting +# when / was still read-only +store_persistent_rules() +{ + # create /etc/udev/rules.d if it does not exist and /etc/udev is writable + [ -d /etc/udev/rules.d ] || \ + dir_writeable /etc/udev && \ + mkdir -p /etc/udev/rules.d + + # only continue if rules-directory is writable + dir_writeable /etc/udev/rules.d || return 0 + + local file dest + for file in /run/udev/tmp-rules--*; do + dest=${file##*tmp-rules--} + [ "$dest" = '*' ] && break + type=${dest##70-persistent-} + type=${type%%.rules} + ebegin "Saving udev persistent ${type} rules to /etc/udev/rules.d" + cat "$file" >> /etc/udev/rules.d/"$dest" && rm -f "$file" + eend $? "Failed moving persistent rules!" + done +} + +start() +{ + # check if this system uses udev + [ -d /run/udev ] || return 0 + + # store persistent-rules that got created while booting + # when / was still read-only + store_persistent_rules +} + +stop() +{ + return 0 +} + +# vim:ts=4 diff --git a/pcr/openrc-core/PKGBUILD b/pcr/openrc-core/PKGBUILD new file mode 100644 index 000000000..1391075e5 --- /dev/null +++ b/pcr/openrc-core/PKGBUILD @@ -0,0 +1,134 @@ +# Maintainer : <freaj@riseup.net> +# Maintainer (Manjaro): artoo <artoo@manjaro.org> +# Contributor (Gentoo): williamh <williamh@gentoo.org> + +_pkgname="openrc" + +_src_uri="http://dev.gentoo.org/~williamh/dist" +_net_uri="http://dev.gentoo.org/~robbat2/distfiles" + +_udev="udev-init-scripts" +_uver=27 + +_net="netifrc" +_nver=0.2.4 + +pkgname=openrc-core +pkgdesc="Gentoo's universal init system, udev enabled." +pkgver=0.13.11 +pkgrel=1 +pkgdesc="Gentoo's universal init system, udev enabled." +arch=('i686' 'x86_64') +url="http://www.gentoo.org/proj/en/base/openrc/" +license=('GPL2') +depends=('inetutils' 'psmisc' 'sysvinit' 'udev>=186') +optdepends=('dhcpcd-openrc: dhcpcd initscript') +conflicts=('openrc' 'openrc-git' 'initscripts' 'systemd-sysvcompat' 'openrc-sysvinit') +backup=('etc/rc.conf' + 'etc/conf.d/consolefont' + 'etc/conf.d/keymaps' + 'etc/conf.d/hostname' + 'etc/conf.d/modules' + 'etc/conf.d/net' + 'etc/conf.d/hwclock' + 'etc/inittab') +install=${_pkgname}.install +source=("${_src_uri}/${_pkgname}-${pkgver}.tar.bz2" + "${_src_uri}/${_udev}-${_uver}.tar.bz2" + "${_net_uri}/${_net}-${_nver}.tar.bz2" + "${_pkgname}.logrotate" + 'kmod-static-nodes' + 'aufs-unmount.patch') + + +_base_args=(SYSCONFDIR=/etc) +if [ -f /etc/os-release ]; then + . /etc/os-release + _base_args+=(BRANDING="$NAME") +else + _base_args+=(BRANDING='Unknown Linux') +fi +_base_args+=(PREFIX=/usr) +_base_args+=(SBINDIR=/usr/bin) + +_rc_args=( "${_base_args[@]}" ) +_rc_args+=(LIBEXECDIR=/usr/lib/rc) +_rc_args+=(MKSELINUX=no) +_rc_args+=(MKPAM=pam) +_rc_args+=(MKTERMCAP=ncurses) +_rc_args+=(MKNET=no) + +_net_args=( "${_base_args[@]}" ) +_net_args+=(LIBEXECDIR=/usr/lib/${_net}) + +prepare(){ + cd "${srcdir}/${_pkgname}-${pkgver}" + local _bin='s|/sbin|/usr/bin|g' + sed -e "${_bin}" -i support/sysvinit/inittab + #sed -i 's:0444:0644:' mk/sys.mk + + patch -p1 -i "$srcdir/aufs-unmount.patch" +} + +build(){ + # make openrc + cd "${srcdir}/${_pkgname}-${pkgver}" + make "${_rc_args[@]}" + # make netifrc + cd "${srcdir}/${_net}-${_nver}" + make "${_net_args[@]}" +} + +package() { + cd "${srcdir}/${_pkgname}-${pkgver}" + make DESTDIR="${pkgdir}" "${_rc_args[@]}" install + # inittab + install -m644 "${srcdir}/${_pkgname}-${pkgver}/support/sysvinit/inittab" "${pkgdir}/etc/inittab" + # logrotate + install -Dm644 "${srcdir}/${_pkgname}.logrotate" "${pkgdir}/etc/logrotate.d/${_pkgname}" + # enable unicode & logger + sed -e 's/#unicode="NO"/unicode="YES"/' \ + -e 's/#rc_logger="YES"/rc_logger="YES"/' \ + -i "${pkgdir}/etc/rc.conf" + + install -d ${pkgdir}/usr/lib/rc/cache + + # udev + cd "${srcdir}/${_udev}-${_uver}" + make DESTDIR="${pkgdir}" install + # fix shebang & path to udevd + local _bin='s|/sbin/udevd|/usr/bin/udevd|g' \ + _shebang='s|#!/sbin/runscript|#!/usr/bin/openrc-run|' + + sed -e "${_shebang}" \ + -e "${_bin}" \ + -i "${pkgdir}/etc/init.d/udev" + # create runlevel + cd "${srcdir}/${_pkgname}-${pkgver}" + ln -sf "/etc/init.d/udev" "${pkgdir}/etc/runlevels/sysinit/udev" + + # netifrc + cd "${srcdir}/${_net}-${_nver}" + make DESTDIR="${pkgdir}" "${_net_args[@]}" install + install -Dm 644 "${srcdir}/${_net}-${_nver}/doc/net.example" "${pkgdir}/etc/conf.d/net" + + _shebang='s|#!/usr/bin/runscript|#!/usr/bin/openrc-run|' + sed -e "${_shebang}" \ + -i "${pkgdir}/etc/init.d/net.lo" + + # create runlevel + ln -sf "/etc/init.d/net.lo" "${pkgdir}/etc/runlevels/boot/net.lo" + + # kmod-static-nodes + cd "${srcdir}/${_pkgname}-${pkgver}" + install -Dm755 "${srcdir}/kmod-static-nodes" "${pkgdir}/etc/init.d/kmod-static-nodes" + + # create runlevel + ln -sf "/etc/init.d/kmod-static-nodes" "${pkgdir}/etc/runlevels/sysinit/kmod-static-nodes" +} +sha256sums=('30edffa8b39d5e68129ddd9e8cd8dfde8ca8cfafc8b470124d7323a32a4a443c' + '1a091c361e9845861c138b505881edcb7b68fcf91708db526dff0b320243c936' + '9b53eb3c8e6e80cd4073a34f911a28055c28b9f7a9f119a397002b0de7ac0691' + '0b44210db9770588bd491cd6c0ac9412d99124c6be4c9d3f7d31ec8746072f5c' + 'fc90e8d480de39aff90e41477f79720a98bee2a2359c53c209d0ca7bb75fb6ba' + '5a22d53f3bda7365d12270845a62ef651f98725c84032ae8c9bdd6512b464ec9') diff --git a/pcr/openrc-core/aufs-unmount.patch b/pcr/openrc-core/aufs-unmount.patch new file mode 100644 index 000000000..76fa5b250 --- /dev/null +++ b/pcr/openrc-core/aufs-unmount.patch @@ -0,0 +1,38 @@ +--- ../init.d/localmount.in.orig 2015-02-18 19:56:50.000000000 +0100 ++++ ../init.d/localmount.in 2015-02-20 01:04:45.783058606 +0100 +@@ -72,19 +72,22 @@ + + local aufs_branch aufs_mount_dir aufs_mount_point aufs_si_dir aufs_si_id + for aufs_si_dir in /sys/fs/aufs/*; do +- aufs_mount_dir=${aufs_si_dir#/sys/fs/aufs/} +- aufs_si_id="$(printf "%s" $aufs_mount_dir | sed 's/_/=/g')" +- aufs_mount_point="$(mountinfo -o ${aufs_si_id})" +- for x in $aufs_si_dir/br[0-9][0-9][0-9]; do +- aufs_branch=$(sed 's/=.*//g' $x) +- eindent +- if ! mount -o "remount,del:$aufs_branch" "$aufs_mount_point" > /dev/null 2>&1; then +- ewarn "Failed to remove branch $aufs_branch from aufs \ +- $aufs_mount_point" +- fi +- eoutdent +- sync +- done ++ if [[ -d ${aufs_si_dir} ]];then ++ aufs_mount_dir=${aufs_si_dir#/sys/fs/aufs/} ++ aufs_si_id="$(printf "%s" $aufs_mount_dir | sed 's/_/=/g')" ++ aufs_mount_point="$(mountinfo -o ${aufs_si_id})" ++ ++ for x in $aufs_si_dir/br[0-9][0-9][0-9]; do ++ aufs_branch=$(sed 's/=.*//g' $x) ++ eindent ++ if ! mount -o "remount,del:$aufs_branch" "$aufs_mount_point" > /dev/null 2>&1; then ++ ewarn "Failed to remove branch $aufs_branch from aufs \ ++ $aufs_mount_point" ++ fi ++ eoutdent ++ sync ++ done ++ fi + done + fi + diff --git a/pcr/openrc-core/kmod-static-nodes b/pcr/openrc-core/kmod-static-nodes new file mode 100644 index 000000000..71bcf9c45 --- /dev/null +++ b/pcr/openrc-core/kmod-static-nodes @@ -0,0 +1,18 @@ +#!/usr/bin/openrc-run +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/kmod/files/Attic/kmod-static-nodes,v 1.2 2014/09/21 10:59:57 ssuominen dead $ + +description="Create list of required static device nodes for the current kernel" + +depend() { + after dev-mount + before tmpfiles.dev dev +} + +start() { + ebegin "Creating list of required static device nodes for the current kernel" + checkpath -q -d /run/tmpfiles.d + kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf + eend $? +} diff --git a/pcr/openrc-core/openrc.install b/pcr/openrc-core/openrc.install new file mode 100644 index 000000000..f789630f7 --- /dev/null +++ b/pcr/openrc-core/openrc.install @@ -0,0 +1,19 @@ +pre_install() { + echo " ==> You can boot up systemd any time." + echo " ==> Add 'init=/usr/lib/systemd/systemd' to kernel command line." +} + +post_install() { + echo " ==> Set up your network interface before you reboot." + local _url="http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4" + echo " ==> Visit ${_url}" + #rc-update -u +} + +post_upgrade() { + post_install "$1" +} + +post_remove() { + echo " ==> Make sure you install systemd-sysvcompat before you reboot!" +}
\ No newline at end of file diff --git a/pcr/openrc-core/openrc.logrotate b/pcr/openrc-core/openrc.logrotate new file mode 100644 index 000000000..a168f2361 --- /dev/null +++ b/pcr/openrc-core/openrc.logrotate @@ -0,0 +1,7 @@ +/var/log/rc.log { + compress + rotate 4 + weekly + missingok + notifempty +} diff --git a/pcr/sysvinit/0001-do-not-build-sulogin-on-archlinux-it-is-provided-by-.patch b/pcr/sysvinit/0001-do-not-build-sulogin-on-archlinux-it-is-provided-by-.patch new file mode 100644 index 000000000..4a7392f1e --- /dev/null +++ b/pcr/sysvinit/0001-do-not-build-sulogin-on-archlinux-it-is-provided-by-.patch @@ -0,0 +1,35 @@ +From 251ed68a591cd869b4d5d15bcb7da1f24a865550 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mattias=20Andr=C3=A9e?= <maandree@operamail.com> +Date: Tue, 5 Nov 2013 08:15:59 +0100 +Subject: [PATCH] do not build sulogin on archlinux, it is provided by + util-linux +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Mattias Andrée <maandree@operamail.com> +--- + src/Makefile | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/Makefile b/src/Makefile +index 9e80533..1998d39 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -37,6 +37,13 @@ MAN1 += utmpdump.1 wall.1 + MAN8 += sulogin.8 bootlogd.8 + endif + ++ifeq ($(DISTRO),archlinux) ++SBIN += bootlogd ++USRBIN += utmpdump wall ++MAN1 += utmpdump.1 wall.1 ++MAN8 += bootlogd.8 ++endif ++ + ifeq ($(DISTRO),Debian) + CPPFLAGS+= -DACCTON_OFF + SBIN += sulogin bootlogd +-- +1.8.4.2 + diff --git a/pcr/sysvinit/0001-simplify-writelog.patch b/pcr/sysvinit/0001-simplify-writelog.patch new file mode 100644 index 000000000..cc28f14bc --- /dev/null +++ b/pcr/sysvinit/0001-simplify-writelog.patch @@ -0,0 +1,126 @@ +From 5577552eb1344ddd661893564b1e628f8edcf13d Mon Sep 17 00:00:00 2001 +From: Florian Pritz <bluewind@xinu.at> +Date: Fri, 15 Jun 2012 16:41:52 +0200 +Subject: [PATCH 1/2] simplify writelog() + +All we do is prepend the date and remove \r. We don't handle color +codes, but the user can just cat the log file in a terminal and it will +interpret the codes correctly. + +Signed-off-by: Florian Pritz <bluewind@xinu.at> +--- + bootlogd.c | 76 +++++++++++++++++------------------------------------------- + 1 file changed, 21 insertions(+), 55 deletions(-) + +diff --git a/bootlogd.c b/bootlogd.c +index 570d382..e36e261 100644 +--- a/bootlogd.c ++++ b/bootlogd.c +@@ -68,11 +68,6 @@ int didnl = 1; + int createlogfile = 0; + int syncalot = 0; + +-struct line { +- char buf[256]; +- int pos; +-} line; +- + /* + * Console devices as listed on the kernel command line and + * the mapping to actual devices in /dev +@@ -351,63 +346,34 @@ int consolename(char *res, int rlen) + */ + void writelog(FILE *fp, unsigned char *ptr, int len) + { +- time_t t; +- char *s; +- char tmp[8]; +- int olen = len; +- int dosync = 0; +- int tlen; +- +- while (len > 0) { +- tmp[0] = 0; +- if (didnl) { ++ int dosync = 0; ++ int i; ++ static int first_run = 1; ++ ++ for (i = 0; i < len; i++) { ++ int ignore = 0; ++ ++ /* prepend date to every line */ ++ if (*(ptr-1) == '\n' || first_run) { ++ time_t t; ++ char *s; + time(&t); + s = ctime(&t); + fprintf(fp, "%.24s: ", s); +- didnl = 0; ++ dosync = 1; ++ first_run = 0; + } +- switch (*ptr) { +- case 27: /* ESC */ +- strcpy(tmp, "^["); +- break; +- case '\r': +- line.pos = 0; +- break; +- case 8: /* ^H */ +- if (line.pos > 0) line.pos--; +- break; +- case '\n': +- didnl = 1; +- dosync = 1; +- break; +- case '\t': +- line.pos += (line.pos / 8 + 1) * 8; +- if (line.pos >= (int)sizeof(line.buf)) +- line.pos = sizeof(line.buf) - 1; +- break; +- case 32 ... 127: +- case 161 ... 255: +- tmp[0] = *ptr; +- tmp[1] = 0; +- break; +- default: +- sprintf(tmp, "\\%03o", *ptr); +- break; +- } +- ptr++; +- len--; + +- tlen = strlen(tmp); +- if (tlen && (line.pos + tlen < (int)sizeof(line.buf))) { +- memcpy(line.buf + line.pos, tmp, tlen); +- line.pos += tlen; ++ if (*ptr == '\r') { ++ ignore = 1; + } +- if (didnl) { +- fprintf(fp, "%s\n", line.buf); +- memset(&line, 0, sizeof(line)); ++ ++ if (!ignore) { ++ fwrite(ptr, sizeof(char), 1, fp); + } +- } + ++ ptr++; ++ } + if (dosync) { + fflush(fp); + if (syncalot) { +@@ -415,7 +381,7 @@ void writelog(FILE *fp, unsigned char *ptr, int len) + } + } + +- outptr += olen; ++ outptr += len; + if (outptr >= endptr) + outptr = ringbuf; + +-- +1.7.10.4 + diff --git a/pcr/sysvinit/0002-remove-ansi-escape-codes-from-log-file.patch b/pcr/sysvinit/0002-remove-ansi-escape-codes-from-log-file.patch new file mode 100644 index 000000000..89b3280df --- /dev/null +++ b/pcr/sysvinit/0002-remove-ansi-escape-codes-from-log-file.patch @@ -0,0 +1,80 @@ +From 8d0022d9540112a92ce8d88c91c4ac10bad8c9ef Mon Sep 17 00:00:00 2001 +From: Florian Pritz <bluewind@xinu.at> +Date: Sun, 24 Jun 2012 15:49:51 +0200 +Subject: [PATCH 2/2] remove ansi escape codes from log file + +References: https://en.wikipedia.org/wiki/ANSI_escape_code + +Signed-off-by: Florian Pritz <bluewind@xinu.at> +--- + bootlogd.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 43 insertions(+), 2 deletions(-) + +diff --git a/bootlogd.c b/bootlogd.c +index e36e261..88e610d 100644 +--- a/bootlogd.c ++++ b/bootlogd.c +@@ -349,6 +349,7 @@ void writelog(FILE *fp, unsigned char *ptr, int len) + int dosync = 0; + int i; + static int first_run = 1; ++ static int inside_esc = 0; + + for (i = 0; i < len; i++) { + int ignore = 0; +@@ -364,10 +365,50 @@ void writelog(FILE *fp, unsigned char *ptr, int len) + first_run = 0; + } + +- if (*ptr == '\r') { +- ignore = 1; ++ /* remove escape sequences, but do it in a way that allows us to stop ++ * in the middle in case the string was cut off */ ++ if (inside_esc == 1) { ++ /* first '[' is special because if we encounter it again, it should be considered the final byte */ ++ if (*ptr == '[') { ++ /* multi char sequence */ ++ ignore = 1; ++ inside_esc = 2; ++ } else { ++ /* single char sequence */ ++ if (*ptr >= 64 && *ptr <= 95) { ++ ignore = 1; ++ } ++ inside_esc = 0; ++ } ++ } else if (inside_esc == 2) { ++ switch (*ptr) { ++ case '0' ... '9': /* intermediate chars of escape sequence */ ++ case ';': ++ case 32 ... 47: ++ if (inside_esc) { ++ ignore = 1; ++ } ++ break; ++ case 64 ... 126: /* final char of escape sequence */ ++ if (inside_esc) { ++ ignore = 1; ++ inside_esc = 0; ++ } ++ break; ++ } ++ } else { ++ switch (*ptr) { ++ case '\r': ++ ignore = 1; ++ break; ++ case 27: /* ESC */ ++ ignore = 1; ++ inside_esc = 1; ++ break; ++ } + } + ++ + if (!ignore) { + fwrite(ptr, sizeof(char), 1, fp); + } +-- +1.7.10.4 + diff --git a/pcr/sysvinit/PKGBUILD b/pcr/sysvinit/PKGBUILD new file mode 100644 index 000000000..b19798b5b --- /dev/null +++ b/pcr/sysvinit/PKGBUILD @@ -0,0 +1,62 @@ +# Maintainer : freaj <freaj@riseup.net> +# Maintainer (Manjaro): artoo <artoo@manjaro.org> +# Contributor (Manjaro): Mattias Andrée <`base64 -d`(bWFhbmRyZWUK)@member.fsf.org> + +pkgname=sysvinit +pkgver=2.88 +pkgrel=16 +pkgdesc='Linux System V Init' +url='http://savannah.nongnu.org/projects/sysvinit' +arch=('i686' 'x86_64' 'armv6h') +license=('GPL') +depends=('glibc') +conflicts=('systemd-sysvcompat') + +source=("http://download.savannah.gnu.org/releases/sysvinit/sysvinit-${pkgver}dsf.tar.bz2" + "0001-simplify-writelog.patch" "0002-remove-ansi-escape-codes-from-log-file.patch" + "0001-do-not-build-sulogin-on-archlinux-it-is-provided-by-.patch") +sha256sums=('60bbc8c1e1792056e23761d22960b30bb13eccc2cabff8c7310a01f4d5df1519' + '8126d09a35bdb9137bb19dc31b58cf1e829137fba34f7dcde7598018e1736826' + '90d38e4351ef9d77088661b411eb2b20eda435676e1e407f3d959ca2064d5c1e' + '43fed9d36b92f15bcdbde6ba2a2784a57115562795942c09dd33ff37a51cb138') + +build() +{ + cd "$srcdir/$pkgname-${pkgver}dsf" + patch -p1 -d "src" -i "$srcdir/0001-simplify-writelog.patch" + patch -p1 -d "src" -i "$srcdir/0002-remove-ansi-escape-codes-from-log-file.patch" + patch -p1 -i "$srcdir/0001-do-not-build-sulogin-on-archlinux-it-is-provided-by-.patch" + + # Patch for Arch's Linux filesystem hierarchy + if [ "$(grep 'execv("/sbin/mount", args);' < src/killall5.c | wc -l)" = 1 ]; then + sed -i 's:execv("/bin/mount", args);::' src/killall5.c + fi + sed -i 's|/bin:/sbin:/usr/bin:/usr/sbin|/usr/bin|' src/initscript.sample src/init.h src/shutdown.c + sed -i 's|/sbin:/usr/sbin:/bin:/usr/bin|/usr/bin|' src/initscript.sample src/init.h src/shutdown.c + sed -i 's|/bin:/usr/bin:/sbin:/usr/sbin|/usr/bin|' src/initscript.sample src/init.h src/shutdown.c + sed -i 's:/sbin/:/bin/:g' contrib/notify-pam-dead.patch man/*.{1,5,8} src/*.{c,h} src/initscript.sample + sed -i 's:/bin/:/usr/bin/:g' contrib/notify-pam-dead.patch man/*.{1,5,8} src/*.{c,h} src/initscript.sample + sed -i 's:/usr/usr/:/usr/:g' contrib/notify-pam-dead.patch man/*.{1,5,8} src/*.{c,h} src/initscript.sample + + make DISTRO=archlinux +} + +package() +{ + cd "$srcdir/$pkgname-${pkgver}dsf" + mkdir -p "$pkgdir/__temp__" + make DISTRO=archlinux ROOT="$pkgdir/__temp__" install + cd "$pkgdir/__temp__" + rm -r bin usr/bin usr/share/man/man?/{mesg,utmpdump,wall,last,pidof}.? usr/share/man/man1 + find . | while read file; do + if [ -d "$file" ]; then + mkdir -p ".$file" + else + cp "$file" ".$file" + fi + done + cd .. + rm -r "__temp__" + mv "$pkgdir/sbin" "$pkgdir/usr/bin" +} + |