summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac23
-rw-r--r--src/util.c133
2 files changed, 5 insertions, 151 deletions
diff --git a/configure.ac b/configure.ac
index bef2418ed7..d95f22dfcc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,7 @@ AC_SUBST(GETTEXT_PACKAGE)
AC_PROG_MKDIR_P
AC_PROG_LN_S
AC_PROG_SED
+AC_PROG_GREP
AC_PROG_AWK
AC_PROG_CC
@@ -394,29 +395,15 @@ AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
AC_PATH_PROG([M4], [m4])
-AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of fedora, suse, debian, ubuntu, arch, gentoo, slackware, altlinux or other]))
+AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of fedora, suse, debian, ubuntu, arch, gentoo, slackware, altlinuxi, mandriva, meego, mageia, angstrom or other]))
if test "z$with_distro" = "z"; then
if test "$cross_compiling" = yes; then
AC_MSG_WARN([Target distribution cannot be reliably detected when cross-compiling. You should specify it with --with-distro (see $0 --help for recognized distros)])
else
- test -f "/etc/redhat-release" && with_distro="fedora"
- test -f "/etc/SuSE-release" && with_distro="suse"
- test -f "/etc/debian_version" && with_distro="debian"
- test -f "/etc/arch-release" && with_distro="arch"
- test -f "/etc/gentoo-release" && with_distro="gentoo"
- test -f "/etc/slackware-version" && with_distro="slackware"
- test -f "/etc/frugalware-release" && with_distro="frugalware"
- test -f "/etc/altlinux-release" && with_distro="altlinux"
- test -f "/etc/mandriva-release" && with_distro="mandriva"
- test -f "/etc/meego-release" && with_distro="meego"
- test -f "/etc/angstrom-version" && with_distro="angstrom"
- test -f "/etc/mageia-release" && with_distro="mageia"
- if test "x`lsb_release -is 2>/dev/null`" = "xUbuntu"; then
- with_distro="ubuntu"
- fi
+ with_distro=$($GREP '^ID=' /etc/os-release | $SED 's/ID=//');
fi
if test "z$with_distro" = "z"; then
- with_distro=`uname -s`
+ with_distro=other
fi
fi
with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
@@ -436,7 +423,7 @@ case $with_distro in
M4_DEFINES=-DTARGET_FEDORA=1
have_plymouth=yes
;;
- suse)
+ opensuse|suse)
SYSTEM_SYSVRCND_PATH=/etc/init.d
AC_DEFINE(TARGET_SUSE, [], [Target is openSUSE/SLE])
M4_DEFINES=-DTARGET_SUSE=1
diff --git a/src/util.c b/src/util.c
index 33299229bf..e9869ea4fa 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3788,139 +3788,6 @@ void status_welcome(void) {
log_warning("Failed to read /etc/os-release: %s", strerror(-r));
}
-#if defined(TARGET_FEDORA)
- if (!pretty_name) {
- if ((r = read_one_line_file("/etc/system-release", &pretty_name)) < 0) {
-
- if (r != -ENOENT)
- log_warning("Failed to read /etc/system-release: %s", strerror(-r));
- }
- }
-
- if (!ansi_color && pretty_name) {
-
- /* This tries to mimic the color magic the old Red Hat sysinit
- * script did. */
-
- if (startswith(pretty_name, "Red Hat"))
- const_color = "0;31"; /* Red for RHEL */
- else if (startswith(pretty_name, "Fedora"))
- const_color = "0;34"; /* Blue for Fedora */
- }
-
-#elif defined(TARGET_SUSE)
-
- if (!pretty_name) {
- if ((r = read_one_line_file("/etc/SuSE-release", &pretty_name)) < 0) {
-
- if (r != -ENOENT)
- log_warning("Failed to read /etc/SuSE-release: %s", strerror(-r));
- }
- }
-
- if (!ansi_color)
- const_color = "0;32"; /* Green for openSUSE */
-
-#elif defined(TARGET_GENTOO)
-
- if (!pretty_name) {
- if ((r = read_one_line_file("/etc/gentoo-release", &pretty_name)) < 0) {
-
- if (r != -ENOENT)
- log_warning("Failed to read /etc/gentoo-release: %s", strerror(-r));
- }
- }
-
- if (!ansi_color)
- const_color = "1;34"; /* Light Blue for Gentoo */
-
-#elif defined(TARGET_ALTLINUX)
-
- if (!pretty_name) {
- if ((r = read_one_line_file("/etc/altlinux-release", &pretty_name)) < 0) {
-
- if (r != -ENOENT)
- log_warning("Failed to read /etc/altlinux-release: %s", strerror(-r));
- }
- }
-
- if (!ansi_color)
- const_color = "0;36"; /* Cyan for ALTLinux */
-
-
-#elif defined(TARGET_DEBIAN)
-
- if (!pretty_name) {
- char *version;
-
- if ((r = read_one_line_file("/etc/debian_version", &version)) < 0) {
-
- if (r != -ENOENT)
- log_warning("Failed to read /etc/debian_version: %s", strerror(-r));
- } else {
- pretty_name = strappend("Debian ", version);
- free(version);
-
- if (!pretty_name)
- log_warning("Failed to allocate Debian version string.");
- }
- }
-
- if (!ansi_color)
- const_color = "1;31"; /* Light Red for Debian */
-
-#elif defined(TARGET_UBUNTU)
-
- if ((r = parse_env_file("/etc/lsb-release", NEWLINE,
- "DISTRIB_DESCRIPTION", &pretty_name,
- NULL)) < 0) {
-
- if (r != -ENOENT)
- log_warning("Failed to read /etc/lsb-release: %s", strerror(-r));
- }
-
- if (!ansi_color)
- const_color = "0;33"; /* Orange/Brown for Ubuntu */
-
-#elif defined(TARGET_MANDRIVA)
-
- if (!pretty_name) {
- char *s, *p;
-
- if ((r = read_one_line_file("/etc/mandriva-release", &s) < 0)) {
- if (r != -ENOENT)
- log_warning("Failed to read /etc/mandriva-release: %s", strerror(-r));
- } else {
- p = strstr(s, " release ");
- if (p) {
- *p = '\0';
- p += 9;
- p[strcspn(p, " ")] = '\0';
-
- /* This corresponds to standard rc.sysinit */
- if (asprintf(&pretty_name, "%s\x1B[0;39m %s", s, p) > 0)
- const_color = "1;36";
- else
- log_warning("Failed to allocate Mandriva version string.");
- } else
- log_warning("Failed to parse /etc/mandriva-release");
- free(s);
- }
- }
-#elif defined(TARGET_MEEGO)
-
- if (!pretty_name) {
- if ((r = read_one_line_file("/etc/meego-release", &pretty_name)) < 0) {
-
- if (r != -ENOENT)
- log_warning("Failed to read /etc/meego-release: %s", strerror(-r));
- }
- }
-
- if (!ansi_color)
- const_color = "1;35"; /* Bright Magenta for MeeGo */
-#endif
-
if (!pretty_name && !const_pretty)
const_pretty = "Linux";