]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
apache: Write hostname into configuration at boot time
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 25 Jun 2018 09:59:49 +0000 (10:59 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 25 Jun 2018 09:59:49 +0000 (10:59 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
lfs/apache2
src/initscripts/system/apache
src/setup/misc.c

index 69b05341da653962262b55fe7d536d6263f066e2..16dd101d78ccb2dd57078cf9294f9325770472f3 100644 (file)
@@ -113,7 +113,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 
        # Install apache config
        cp -rf $(DIR_CONF)/httpd/* /etc/httpd/conf
-       ln -sf $(CONFIG_ROOT)/main/hostname.conf /etc/httpd/conf/
+       touch /etc/httpd/conf/hostname.conf
 
        # Create captive logging directory
        -mkdir -pv /var/log/httpd/captive
index f2a9fb87207d4a2bea16f7aebaa80777b86cdd43..d9cc7fa48d64a5ffd0fb7b880ab22b95a4f8fb5a 100644 (file)
@@ -61,6 +61,9 @@ case "$1" in
                # Generate all required certificates
                generate_certificates
 
+               # Update hostname
+               echo "ServerName ${HOSTNAME}" > /etc/httpd/conf/hostname.conf
+
                boot_mesg "Starting Apache daemon..."
                /usr/sbin/apachectl -k start
                evaluate_retval
index a31b1d8a844a9d4c27047b0632665fc7cedc03a0..0710c5b955a6488c62ea4c5ff71793a19bd78a7b 100644 (file)
@@ -57,15 +57,6 @@ int writehostsfiles(void)
        findkey(kv, "DOMAINNAME", domainname);
        freekeyvalues(kv);
                
-       if (!(file = fopen(CONFIG_ROOT "/main/hostname.conf", "w")))
-       {
-               sprintf (message, _("Unable to write %s/main/hostname.conf"), CONFIG_ROOT);
-               errorbox(message);
-               return 0;
-       }
-       fprintf(file, "ServerName %s.%s\n", hostname,domainname);
-       fclose(file);
-       
        if (!(file = fopen(CONFIG_ROOT "/main/hosts", "r")))
        {
                errorbox(_("Unable to open main hosts file."));