dnsdomainname: split it from "hostname", make it independently selectable
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 13 Nov 2016 21:35:10 +0000 (22:35 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 13 Nov 2016 21:35:10 +0000 (22:35 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
include/applets.src.h
networking/Config.src
networking/Kbuild.src
networking/hostname.c

index 248d539c48d0f1b427ba214be02baeba3637443f..dbc45953c9f0e92d7fc02353c1e2ff0e3a001d16 100644 (file)
@@ -112,7 +112,6 @@ IF_DHCPRELAY(APPLET(dhcprelay, BB_DIR_USR_SBIN, BB_SUID_DROP))
 IF_DIRNAME(APPLET_NOFORK(dirname, dirname, BB_DIR_USR_BIN, BB_SUID_DROP, dirname))
 IF_DMESG(APPLET(dmesg, BB_DIR_BIN, BB_SUID_DROP))
 IF_DNSD(APPLET(dnsd, BB_DIR_USR_SBIN, BB_SUID_DROP))
-IF_HOSTNAME(APPLET_ODDNAME(dnsdomainname, hostname, BB_DIR_BIN, BB_SUID_DROP, dnsdomainname))
 IF_DOS2UNIX(APPLET_NOEXEC(dos2unix, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, dos2unix))
 IF_DU(APPLET(du, BB_DIR_USR_BIN, BB_SUID_DROP))
 IF_DUMPKMAP(APPLET(dumpkmap, BB_DIR_BIN, BB_SUID_DROP))
@@ -158,7 +157,6 @@ IF_HD(APPLET_NOEXEC(hd, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hd))
 IF_HDPARM(APPLET(hdparm, BB_DIR_SBIN, BB_SUID_DROP))
 IF_HEAD(APPLET_NOEXEC(head, head, BB_DIR_USR_BIN, BB_SUID_DROP, head))
 IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hexdump))
-IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP))
 IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
 IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP))
 IF_IFCONFIG(APPLET(ifconfig, BB_DIR_SBIN, BB_SUID_DROP))
index eb0536a7c9302bdae684411b83e4b0119261b517..398a5ee256bd02a3e33861ebd3b713a7703a0928 100644 (file)
@@ -160,12 +160,6 @@ config FEATURE_FTPGETPUT_LONG_OPTIONS
        help
          Support long options for the ftpget/ftpput applet.
 
-config HOSTNAME
-       bool "hostname"
-       default y
-       help
-         Show or set the system's host name.
-
 config HTTPD
        bool "httpd"
        default y
index 79f54824b3583e25e8e3f85079da8125e83862f5..e14070647441c733bb11af1f55b6410dd4b1b744 100644 (file)
@@ -16,7 +16,6 @@ lib-$(CONFIG_FAKEIDENTD)   += isrv_identd.o isrv.o
 lib-$(CONFIG_FTPD)         += ftpd.o
 lib-$(CONFIG_FTPGET)       += ftpgetput.o
 lib-$(CONFIG_FTPPUT)       += ftpgetput.o
-lib-$(CONFIG_HOSTNAME)     += hostname.o
 lib-$(CONFIG_HTTPD)        += httpd.o
 lib-$(CONFIG_IFCONFIG)     += ifconfig.o interface.o
 lib-$(CONFIG_IFENSLAVE)    += ifenslave.o interface.o
index b3e3522426bc8aceee9a9868fc2dfff1928e201f..04a051ede7f79089eb98a4d43d9e989ddb990158 100644 (file)
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
 
+//config:config HOSTNAME
+//config:      bool "hostname"
+//config:      default y
+//config:      help
+//config:        Show or set the system's host name.
+//config:
+//config:config DNSDOMAINNAME
+//config:      bool "dnsdomainname"
+//config:      default y
+//config:      help
+//config:        Alias to "hostname -d".
+
+//applet:IF_DNSDOMAINNAME(APPLET_ODDNAME(dnsdomainname, hostname, BB_DIR_BIN, BB_SUID_DROP, dnsdomainname))
+//applet:IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP))
+
+//kbuild: lib-$(CONFIG_HOSTNAME) += hostname.o
+//kbuild: lib-$(CONFIG_DNSDOMAINNAME) += hostname.o
+
 //usage:#define hostname_trivial_usage
 //usage:       "[OPTIONS] [HOSTNAME | -F FILE]"
 //usage:#define hostname_full_usage "\n\n"
@@ -131,8 +149,12 @@ int hostname_main(int argc UNUSED_PARAM, char **argv)
        opts = getopt32(argv, "dfisF:v", &hostname_str);
        argv += optind;
        buf = safe_gethostname();
-       if (applet_name[0] == 'd') /* dnsdomainname? */
-               opts = OPT_d;
+       if (ENABLE_DNSDOMAINNAME) {
+               if (!ENABLE_HOSTNAME || applet_name[0] == 'd') {
+                       /* dnsdomainname */
+                       opts = OPT_d;
+               }
+       }
 
        if (opts & OPT_dfi) {
                /* Cases when we need full hostname (or its part) */