From 701d8158f31d695a453704b1b8f8f03bda93a39f Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 8 Feb 2018 18:16:49 +0100 Subject: sys-apps/systemd: show proper networkctl display type Upstream commit: https://github.com/systemd/systemd/commit/3b8f29fd93899c4876a6ef53f9bcb6b40e1c98e7 Package-Manager: Portage-2.3.24, Repoman-2.3.6 --- .../files/237-0001-networkctl-display-type.patch | 266 +++++++++++++ sys-apps/systemd/systemd-237-r1.ebuild | 439 -------------------- sys-apps/systemd/systemd-237-r2.ebuild | 440 +++++++++++++++++++++ 3 files changed, 706 insertions(+), 439 deletions(-) create mode 100644 sys-apps/systemd/files/237-0001-networkctl-display-type.patch delete mode 100644 sys-apps/systemd/systemd-237-r1.ebuild create mode 100644 sys-apps/systemd/systemd-237-r2.ebuild (limited to 'sys-apps/systemd') diff --git a/sys-apps/systemd/files/237-0001-networkctl-display-type.patch b/sys-apps/systemd/files/237-0001-networkctl-display-type.patch new file mode 100644 index 000000000000..e29cf2206aa2 --- /dev/null +++ b/sys-apps/systemd/files/237-0001-networkctl-display-type.patch @@ -0,0 +1,266 @@ +From a18461bc7d446f8e130e9276de4397d00059267f Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Mon, 29 Jan 2018 20:58:24 +0100 +Subject: [PATCH 1/4] networkd: display wireguard devtype + +It's not useful to simply show "none", when we have more interesting +information to display. + +Signed-off-by: Jason A. Donenfeld +--- + src/network/networkctl.c | 22 +++++++++++++++------- + 1 file changed, 15 insertions(+), 7 deletions(-) + +diff --git a/src/network/networkctl.c b/src/network/networkctl.c +index 59ce098cd1..6ce00dff6d 100644 +--- a/src/network/networkctl.c ++++ b/src/network/networkctl.c +@@ -62,18 +62,26 @@ static int link_get_type_string(unsigned short iftype, sd_device *d, char **ret) + + assert(ret); + +- if (iftype == ARPHRD_ETHER && d) { ++ if (d) { + const char *devtype = NULL, *id = NULL; ++ ++ (void) sd_device_get_devtype(d, &devtype); ++ + /* WLANs have iftype ARPHRD_ETHER, but we want + * to show a more useful type string for + * them */ ++ if (iftype == ARPHRD_ETHER) { ++ if (streq_ptr(devtype, "wlan")) ++ id = "wlan"; ++ else if (streq_ptr(devtype, "wwan")) ++ id = "wwan"; ++ } + +- (void) sd_device_get_devtype(d, &devtype); +- +- if (streq_ptr(devtype, "wlan")) +- id = "wlan"; +- else if (streq_ptr(devtype, "wwan")) +- id = "wwan"; ++ /* Likewise, WireGuard has iftype ARPHRD_NONE, ++ * since it's layer 3, but we of course want ++ * something more useful than that. */ ++ if (iftype == ARPHRD_NONE && streq_ptr(devtype, "wireguard")) ++ id = "wireguard"; + + if (id) { + p = strdup(id); + +From f119082e7a1ccfbf50c30a99819b6e303cdf09a1 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Mon, 29 Jan 2018 21:01:46 +0100 +Subject: [PATCH 2/4] networkd: simplify and display all devtypes + +Every place the kernel actually calls SET_NETDEV_DEVTYPE, it's adding a +piece of information that looks useful and relevant for us to use. So +let's use it when it's there. + +The previous matching based on the corresponding ARPHRD didn't really +make much sense. The more sensible logic for getting a textual +representation of the link type is to see if the kernel supplies a +devtype. If it does, great. If not, then we can fall back on the ARPHRD, +as before. + +Signed-off-by: Jason A. Donenfeld +--- + src/network/networkctl.c | 23 +++-------------------- + 1 file changed, 3 insertions(+), 20 deletions(-) + +diff --git a/src/network/networkctl.c b/src/network/networkctl.c +index 6ce00dff6d..8a08304240 100644 +--- a/src/network/networkctl.c ++++ b/src/network/networkctl.c +@@ -63,28 +63,11 @@ static int link_get_type_string(unsigned short iftype, sd_device *d, char **ret) + assert(ret); + + if (d) { +- const char *devtype = NULL, *id = NULL; ++ const char *devtype = NULL; + + (void) sd_device_get_devtype(d, &devtype); +- +- /* WLANs have iftype ARPHRD_ETHER, but we want +- * to show a more useful type string for +- * them */ +- if (iftype == ARPHRD_ETHER) { +- if (streq_ptr(devtype, "wlan")) +- id = "wlan"; +- else if (streq_ptr(devtype, "wwan")) +- id = "wwan"; +- } +- +- /* Likewise, WireGuard has iftype ARPHRD_NONE, +- * since it's layer 3, but we of course want +- * something more useful than that. */ +- if (iftype == ARPHRD_NONE && streq_ptr(devtype, "wireguard")) +- id = "wireguard"; +- +- if (id) { +- p = strdup(id); ++ if (!isempty(devtype)) { ++ p = strdup(devtype); + if (!p) + return -ENOMEM; + + +From fdce7817b9a27a370c01b7dd9da6a84fcae1038e Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Mon, 29 Jan 2018 21:05:36 +0100 +Subject: [PATCH 3/4] networkd: clean up link_get_type_string + +The return value is always ignored, so get rid of it. + +Signed-off-by: Jason A. Donenfeld +--- + src/network/networkctl.c | 16 +++++++--------- + 1 file changed, 7 insertions(+), 9 deletions(-) + +diff --git a/src/network/networkctl.c b/src/network/networkctl.c +index 8a08304240..7b33e0db17 100644 +--- a/src/network/networkctl.c ++++ b/src/network/networkctl.c +@@ -56,7 +56,7 @@ static bool arg_no_pager = false; + static bool arg_legend = true; + static bool arg_all = false; + +-static int link_get_type_string(unsigned short iftype, sd_device *d, char **ret) { ++static void link_get_type_string(unsigned short iftype, sd_device *d, char **ret) { + const char *t; + char *p; + +@@ -69,27 +69,25 @@ static int link_get_type_string(unsigned short iftype, sd_device *d, char **ret) + if (!isempty(devtype)) { + p = strdup(devtype); + if (!p) +- return -ENOMEM; ++ return; + + *ret = p; +- return 1; ++ return; + } + } + + t = arphrd_to_name(iftype); + if (!t) { + *ret = NULL; +- return 0; ++ return; + } + + p = strdup(t); + if (!p) +- return -ENOMEM; ++ return; + + ascii_strlower(p); + *ret = p; +- +- return 0; + } + + static void operational_state_to_color(const char *state, const char **on, const char **off) { +@@ -314,7 +312,7 @@ static int list_links(int argc, char *argv[], void *userdata) { + xsprintf(devid, "n%i", links[i].ifindex); + (void) sd_device_new_from_device_id(&d, devid); + +- (void) link_get_type_string(links[i].iftype, d, &t); ++ link_get_type_string(links[i].iftype, d, &t); + + printf("%3i %-16s %-18s %s%-11s%s %s%-10s%s\n", + links[i].ifindex, links[i].name, strna(t), +@@ -807,7 +805,7 @@ static int link_status_one( + (void) sd_device_get_property_value(d, "ID_MODEL", &model); + } + +- (void) link_get_type_string(info->iftype, d, &t); ++ link_get_type_string(info->iftype, d, &t); + + (void) sd_network_link_get_network_file(info->ifindex, &network); + + +From b55822c349d3e0559c1efc7475fd0f74cf086453 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Mon, 29 Jan 2018 21:08:39 +0100 +Subject: [PATCH 4/4] networkd: clean up link_get_type_string returns + +It's cleaner and more consistent to actually return what we were +planning on returning. + +Signed-off-by: Jason A. Donenfeld +--- + src/network/networkctl.c | 28 +++++++++------------------- + 1 file changed, 9 insertions(+), 19 deletions(-) + +diff --git a/src/network/networkctl.c b/src/network/networkctl.c +index 7b33e0db17..14d8ecb03f 100644 +--- a/src/network/networkctl.c ++++ b/src/network/networkctl.c +@@ -56,38 +56,28 @@ static bool arg_no_pager = false; + static bool arg_legend = true; + static bool arg_all = false; + +-static void link_get_type_string(unsigned short iftype, sd_device *d, char **ret) { ++static char *link_get_type_string(unsigned short iftype, sd_device *d) { + const char *t; + char *p; + +- assert(ret); +- + if (d) { + const char *devtype = NULL; + + (void) sd_device_get_devtype(d, &devtype); +- if (!isempty(devtype)) { +- p = strdup(devtype); +- if (!p) +- return; +- +- *ret = p; +- return; +- } ++ if (!isempty(devtype)) ++ return strdup(devtype); + } + + t = arphrd_to_name(iftype); +- if (!t) { +- *ret = NULL; +- return; +- } ++ if (!t) ++ return NULL; + + p = strdup(t); + if (!p) +- return; ++ return NULL; + + ascii_strlower(p); +- *ret = p; ++ return p; + } + + static void operational_state_to_color(const char *state, const char **on, const char **off) { +@@ -312,7 +302,7 @@ static int list_links(int argc, char *argv[], void *userdata) { + xsprintf(devid, "n%i", links[i].ifindex); + (void) sd_device_new_from_device_id(&d, devid); + +- link_get_type_string(links[i].iftype, d, &t); ++ t = link_get_type_string(links[i].iftype, d); + + printf("%3i %-16s %-18s %s%-11s%s %s%-10s%s\n", + links[i].ifindex, links[i].name, strna(t), +@@ -805,7 +795,7 @@ static int link_status_one( + (void) sd_device_get_property_value(d, "ID_MODEL", &model); + } + +- link_get_type_string(info->iftype, d, &t); ++ t = link_get_type_string(info->iftype, d); + + (void) sd_network_link_get_network_file(info->ifindex, &network); + diff --git a/sys-apps/systemd/systemd-237-r1.ebuild b/sys-apps/systemd/systemd-237-r1.ebuild deleted file mode 100644 index 97ed32eebe70..000000000000 --- a/sys-apps/systemd/systemd-237-r1.ebuild +++ /dev/null @@ -1,439 +0,0 @@ -# Copyright 1999-2018 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -if [[ ${PV} == 9999 ]]; then - EGIT_REPO_URI="https://github.com/systemd/systemd.git" - inherit git-r3 -else - SRC_URI="https://github.com/systemd/systemd/archive/v${PV}/${P}.tar.gz" - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~x86" -fi - -PYTHON_COMPAT=( python{3_4,3_5,3_6} ) - -inherit bash-completion-r1 linux-info meson multilib-minimal ninja-utils pam python-any-r1 systemd toolchain-funcs udev user - -DESCRIPTION="System and service manager for Linux" -HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd" - -LICENSE="GPL-2 LGPL-2.1 MIT public-domain" -SLOT="0/2" -IUSE="acl apparmor audit build cryptsetup curl elfutils +gcrypt gnuefi http idn importd +kmod libidn2 +lz4 lzma nat pam pcre policykit qrcode +seccomp selinux ssl +sysv-utils test usrmerge vanilla xkb" - -REQUIRED_USE="importd? ( curl gcrypt lzma )" -RESTRICT="!test? ( test )" - -MINKV="3.11" - -COMMON_DEPEND=">=sys-apps/util-linux-2.30:0=[${MULTILIB_USEDEP}] - sys-libs/libcap:0=[${MULTILIB_USEDEP}] - !=sys-process/audit-2:0= ) - cryptsetup? ( >=sys-fs/cryptsetup-1.6:0= ) - curl? ( net-misc/curl:0= ) - elfutils? ( >=dev-libs/elfutils-0.158:0= ) - gcrypt? ( >=dev-libs/libgcrypt-1.4.5:0=[${MULTILIB_USEDEP}] ) - http? ( - >=net-libs/libmicrohttpd-0.9.33:0= - ssl? ( >=net-libs/gnutls-3.1.4:0= ) - ) - idn? ( - libidn2? ( net-dns/libidn2 ) - !libidn2? ( net-dns/libidn ) - ) - importd? ( - app-arch/bzip2:0= - sys-libs/zlib:0= - ) - kmod? ( >=sys-apps/kmod-15:0= ) - lz4? ( >=app-arch/lz4-0_p131:0=[${MULTILIB_USEDEP}] ) - lzma? ( >=app-arch/xz-utils-5.0.5-r1:0=[${MULTILIB_USEDEP}] ) - nat? ( net-firewall/iptables:0= ) - pam? ( virtual/pam:=[${MULTILIB_USEDEP}] ) - pcre? ( dev-libs/libpcre2 ) - qrcode? ( media-gfx/qrencode:0= ) - seccomp? ( >=sys-libs/libseccomp-2.3.1:0= ) - selinux? ( sys-libs/libselinux:0= ) - xkb? ( >=x11-libs/libxkbcommon-0.4.1:0= ) - abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r9 - !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" - -# baselayout-2.2 has /run -RDEPEND="${COMMON_DEPEND} - >=sys-apps/baselayout-2.2 - selinux? ( sec-policy/selinux-base-policy[systemd] ) - sysv-utils? ( !sys-apps/sysvinit ) - !sysv-utils? ( sys-apps/sysvinit ) - !build? ( || ( - sys-apps/util-linux[kill(-)] - sys-process/procps[kill(+)] - sys-apps/coreutils[kill(-)] - ) ) - !sys-auth/nss-myhostname - ! "${locale_conf}" <<-EOF - # This file has been created by the sys-apps/systemd ebuild. - # See locale.conf(5) and localectl(1). - - # LANG=${LANG} - EOF - eend ${?} || FAIL=1 - fi - fi - - if [[ ! -L ${envd_locale} ]]; then - # now, if env.d/??locale is not a symlink (to locale.conf)... - if [[ -e ${envd_locale} ]]; then - # ...warn the user that he has duplicate locale settings - ewarn - ewarn "To ensure consistent behavior, you should replace ${envd_locale}" - ewarn "with a symlink to ${locale_conf}. Please migrate your settings" - ewarn "and create the symlink with the following command:" - ewarn "ln -s -n -f ../locale.conf ${envd_locale}" - ewarn - else - # ...or just create the symlink if there's nothing here - ebegin "Creating ${envd_locale_def} -> ../locale.conf symlink" - ln -n -s ../locale.conf "${envd_locale_def}" - eend ${?} || FAIL=1 - fi - fi -} - -pkg_postinst() { - newusergroup() { - enewgroup "$1" - enewuser "$1" -1 -1 -1 "$1" - } - - enewgroup input - enewgroup kvm 78 - enewgroup render - enewgroup systemd-journal - newusergroup systemd-bus-proxy - newusergroup systemd-coredump - newusergroup systemd-journal-gateway - newusergroup systemd-journal-remote - newusergroup systemd-journal-upload - newusergroup systemd-network - newusergroup systemd-resolve - newusergroup systemd-timesync - - systemd_update_catalog - - # Keep this here in case the database format changes so it gets updated - # when required. Despite that this file is owned by sys-apps/hwids. - if has_version "sys-apps/hwids[udev]"; then - udevadm hwdb --update --root="${EROOT%/}" - fi - - udev_reload || FAIL=1 - - # Bug 465468, make sure locales are respect, and ensure consistency - # between OpenRC & systemd - migrate_locale - - systemd_reenable systemd-networkd.service systemd-resolved.service - - if [[ ${FAIL} ]]; then - eerror "One of the postinst commands failed. Please check the postinst output" - eerror "for errors. You may need to clean up your system and/or try installing" - eerror "systemd again." - eerror - fi -} - -pkg_prerm() { - # If removing systemd completely, remove the catalog database. - if [[ ! ${REPLACED_BY_VERSION} ]]; then - rm -f -v "${EROOT}"/var/lib/systemd/catalog/database - fi -} diff --git a/sys-apps/systemd/systemd-237-r2.ebuild b/sys-apps/systemd/systemd-237-r2.ebuild new file mode 100644 index 000000000000..71abd1c33595 --- /dev/null +++ b/sys-apps/systemd/systemd-237-r2.ebuild @@ -0,0 +1,440 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +if [[ ${PV} == 9999 ]]; then + EGIT_REPO_URI="https://github.com/systemd/systemd.git" + inherit git-r3 +else + SRC_URI="https://github.com/systemd/systemd/archive/v${PV}/${P}.tar.gz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~x86" +fi + +PYTHON_COMPAT=( python{3_4,3_5,3_6} ) + +inherit bash-completion-r1 linux-info meson multilib-minimal ninja-utils pam python-any-r1 systemd toolchain-funcs udev user + +DESCRIPTION="System and service manager for Linux" +HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd" + +LICENSE="GPL-2 LGPL-2.1 MIT public-domain" +SLOT="0/2" +IUSE="acl apparmor audit build cryptsetup curl elfutils +gcrypt gnuefi http idn importd +kmod libidn2 +lz4 lzma nat pam pcre policykit qrcode +seccomp selinux ssl +sysv-utils test usrmerge vanilla xkb" + +REQUIRED_USE="importd? ( curl gcrypt lzma )" +RESTRICT="!test? ( test )" + +MINKV="3.11" + +COMMON_DEPEND=">=sys-apps/util-linux-2.30:0=[${MULTILIB_USEDEP}] + sys-libs/libcap:0=[${MULTILIB_USEDEP}] + !=sys-process/audit-2:0= ) + cryptsetup? ( >=sys-fs/cryptsetup-1.6:0= ) + curl? ( net-misc/curl:0= ) + elfutils? ( >=dev-libs/elfutils-0.158:0= ) + gcrypt? ( >=dev-libs/libgcrypt-1.4.5:0=[${MULTILIB_USEDEP}] ) + http? ( + >=net-libs/libmicrohttpd-0.9.33:0= + ssl? ( >=net-libs/gnutls-3.1.4:0= ) + ) + idn? ( + libidn2? ( net-dns/libidn2 ) + !libidn2? ( net-dns/libidn ) + ) + importd? ( + app-arch/bzip2:0= + sys-libs/zlib:0= + ) + kmod? ( >=sys-apps/kmod-15:0= ) + lz4? ( >=app-arch/lz4-0_p131:0=[${MULTILIB_USEDEP}] ) + lzma? ( >=app-arch/xz-utils-5.0.5-r1:0=[${MULTILIB_USEDEP}] ) + nat? ( net-firewall/iptables:0= ) + pam? ( virtual/pam:=[${MULTILIB_USEDEP}] ) + pcre? ( dev-libs/libpcre2 ) + qrcode? ( media-gfx/qrencode:0= ) + seccomp? ( >=sys-libs/libseccomp-2.3.1:0= ) + selinux? ( sys-libs/libselinux:0= ) + xkb? ( >=x11-libs/libxkbcommon-0.4.1:0= ) + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r9 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" + +# baselayout-2.2 has /run +RDEPEND="${COMMON_DEPEND} + >=sys-apps/baselayout-2.2 + selinux? ( sec-policy/selinux-base-policy[systemd] ) + sysv-utils? ( !sys-apps/sysvinit ) + !sysv-utils? ( sys-apps/sysvinit ) + !build? ( || ( + sys-apps/util-linux[kill(-)] + sys-process/procps[kill(+)] + sys-apps/coreutils[kill(-)] + ) ) + !sys-auth/nss-myhostname + ! "${locale_conf}" <<-EOF + # This file has been created by the sys-apps/systemd ebuild. + # See locale.conf(5) and localectl(1). + + # LANG=${LANG} + EOF + eend ${?} || FAIL=1 + fi + fi + + if [[ ! -L ${envd_locale} ]]; then + # now, if env.d/??locale is not a symlink (to locale.conf)... + if [[ -e ${envd_locale} ]]; then + # ...warn the user that he has duplicate locale settings + ewarn + ewarn "To ensure consistent behavior, you should replace ${envd_locale}" + ewarn "with a symlink to ${locale_conf}. Please migrate your settings" + ewarn "and create the symlink with the following command:" + ewarn "ln -s -n -f ../locale.conf ${envd_locale}" + ewarn + else + # ...or just create the symlink if there's nothing here + ebegin "Creating ${envd_locale_def} -> ../locale.conf symlink" + ln -n -s ../locale.conf "${envd_locale_def}" + eend ${?} || FAIL=1 + fi + fi +} + +pkg_postinst() { + newusergroup() { + enewgroup "$1" + enewuser "$1" -1 -1 -1 "$1" + } + + enewgroup input + enewgroup kvm 78 + enewgroup render + enewgroup systemd-journal + newusergroup systemd-bus-proxy + newusergroup systemd-coredump + newusergroup systemd-journal-gateway + newusergroup systemd-journal-remote + newusergroup systemd-journal-upload + newusergroup systemd-network + newusergroup systemd-resolve + newusergroup systemd-timesync + + systemd_update_catalog + + # Keep this here in case the database format changes so it gets updated + # when required. Despite that this file is owned by sys-apps/hwids. + if has_version "sys-apps/hwids[udev]"; then + udevadm hwdb --update --root="${EROOT%/}" + fi + + udev_reload || FAIL=1 + + # Bug 465468, make sure locales are respect, and ensure consistency + # between OpenRC & systemd + migrate_locale + + systemd_reenable systemd-networkd.service systemd-resolved.service + + if [[ ${FAIL} ]]; then + eerror "One of the postinst commands failed. Please check the postinst output" + eerror "for errors. You may need to clean up your system and/or try installing" + eerror "systemd again." + eerror + fi +} + +pkg_prerm() { + # If removing systemd completely, remove the catalog database. + if [[ ! ${REPLACED_BY_VERSION} ]]; then + rm -f -v "${EROOT}"/var/lib/systemd/catalog/database + fi +} -- cgit v1.2.3-65-gdbad