From 6bd9912054e39bb0665ba0fcaef722af7eabe624 Mon Sep 17 00:00:00 2001 From: Martin Dummer Date: Thu, 3 Feb 2022 22:30:58 +0100 Subject: acct-user/vdr: fix creation of user Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Martin Dummer Closes: https://github.com/gentoo/gentoo/pull/24073 Signed-off-by: Joonas Niilola --- acct-user/vdr/vdr-0-r1.ebuild | 63 +++++++++++++++++++++++++++++++++++++++++++ acct-user/vdr/vdr-0.ebuild | 62 ------------------------------------------ 2 files changed, 63 insertions(+), 62 deletions(-) create mode 100644 acct-user/vdr/vdr-0-r1.ebuild delete mode 100644 acct-user/vdr/vdr-0.ebuild (limited to 'acct-user') diff --git a/acct-user/vdr/vdr-0-r1.ebuild b/acct-user/vdr/vdr-0-r1.ebuild new file mode 100644 index 000000000000..7871f9fcef97 --- /dev/null +++ b/acct-user/vdr/vdr-0-r1.ebuild @@ -0,0 +1,63 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit acct-user user-info + +ACCT_USER_ID=452 +ACCT_USER_HOME=/var/lib/vdr +ACCT_USER_GROUPS=( vdr audio cdrom video ) + +DESCRIPTION="VDR (VideoDiskRecorder) service user" +IUSE="graphlcd legacy-homedir remote serial systemd" + +acct-user_add_deps + +pkg_setup() { + # if user wants to preserve his existing vdr installation, + # he can set USE=legacy-homedir + use legacy-homedir && ACCT_USER_HOME=/var/vdr + + # media-plugins/vdr-graphlcd + use graphlcd && ACCT_USER_GROUPS+=( lp usb ) + + # media-plugins/vdr-remote, _only_ when systemd is installed + if use remote; then + if use systemd; then + ACCT_USER_GROUPS+=( input ) + else + einfo "use-flag remote has no effect on systemd systems" + fi + fi + + # media-plugins/vdr-serial: add group to access /dev/ttyS* + # on systemd systems: add "dialout" + # non-systemd systems: add "uucp" + if use serial; then + if use systemd; then + ACCT_USER_GROUPS+=( dialout ) + else + ACCT_USER_GROUPS+=( uucp ) + fi + fi +} + +pkg_preinst() { + # if useflag legacy-homedir is _not_ set, check if user vdr exists and what his homedir is + if ! use legacy-homedir; then + local EXISTING_HOME=$(egethome vdr) + if [[ "${EXISTING_HOME}" = "/var/vdr" ]]; then + ewarn "The user \"vdr\" exists on this system, his current home directory is \"/var/vdr\"" + ewarn "The new default home directory for user vdr is \"/var/lib/vdr\"" + ewarn "You have three options to continue:" + ewarn " - set USE=legacy-homedir for ${CATEGORY}/${PN} to continue to use /var/vdr" + ewarn " - move /var/vdr to /var/lib/vdr manually and repeat to install ${CATEGORY}/${PN}" + ewarn " - move /var/vdr to /var/vdr.old or anywhere else (to keep it as your backup), repeat to" + ewarn " install ${CATEGORY}/${PN} and let the installation create a fresh /var/lib/vdr" + ewarn "the emerge will stop here." + die "user action required" + fi + fi + acct-user_pkg_preinst +} diff --git a/acct-user/vdr/vdr-0.ebuild b/acct-user/vdr/vdr-0.ebuild deleted file mode 100644 index 55986b2ff78d..000000000000 --- a/acct-user/vdr/vdr-0.ebuild +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright 2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit acct-user user-info - -ACCT_USER_ID=452 -ACCT_USER_HOME=/var/lib/vdr -ACCT_USER_GROUPS=( vdr audio cdrom video ) - -DESCRIPTION="VDR (VideoDiskRecorder) service user" -IUSE="graphlcd legacy-homedir remote serial systemd" - -acct-user_add_deps - -pkg_setup() { - # if user wants to preserve his existing vdr installation, - # he can set USE=legacy-homedir - use legacy-homedir && ACCT_USER_HOME=/var/vdr - - # media-plugins/vdr-graphlcd - use graphlcd && ACCT_USER_GROUPS+=( lp usb ) - - # media-plugins/vdr-remote, _only_ when systemd is installed - if use remote; then - if use systemd; then - ACCT_USER_GROUPS+=( input ) - else - einfo "use-flag remote has no effect on systemd systems" - fi - fi - - # media-plugins/vdr-serial: add group to access /dev/ttyS* - # on systemd systems: add "dialout" - # non-systemd systems: add "uucp" - if use serial; then - if use systemd; then - ACCT_USER_GROUPS+=( dialout ) - else - ACCT_USER_GROUPS+=( uucp ) - fi - fi -} - -pkg_preinst() { - # if useflag legacy-homedir is _not_ set, check if user vdr exists and what his homedir is - if ! use legacy-homedir; then - local EXISTING_HOME=$(egethome vdr) - if [[ "${EXISTING_HOME}" = "/var/vdr" ]]; then - ewarn "The user \"vdr\" exists on this system, his current home directory is \"/var/vdr\"" - ewarn "The new default home directory for user vdr is \"/var/lib/vdr\"" - ewarn "You have three options to continue:" - ewarn " - set USE=legacy-homedir for ${CATEGORY}/${PN} to continue to use /var/vdr" - ewarn " - move /var/vdr to /var/lib/vdr manually and repeat to install ${CATEGORY}/${PN}" - ewarn " - move /var/vdr to /var/vdr.old or anywhere else (to keep it as your backup), repeat to" - ewarn " install ${CATEGORY}/${PN} and let the installation create a fresh /var/lib/vdr" - ewarn "the emerge will stop here." - die "user action required" - fi - fi -} -- cgit v1.2.3-65-gdbad