X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=src%2Finstall%2Bsetup%2Finstall%2Funattended.c;h=77e1eabbdc94f95d564173d14fa2504034992fd1;hb=91b20d84de68c80e230838e81a470c7bf5d3457b;hp=267989b8237404cef68bf5e8a6c209d42f2fc175;hpb=ac52a0f47710496b5cc30712bf9d99a8d20d3358;p=people%2Fteissler%2Fipfire-2.x.git diff --git a/src/install+setup/install/unattended.c b/src/install+setup/install/unattended.c index 267989b82..77e1eabbd 100644 --- a/src/install+setup/install/unattended.c +++ b/src/install+setup/install/unattended.c @@ -41,7 +41,7 @@ int unattended_setup(struct keyvalue *unattendedkv) { char green_broadcast[STRING_SIZE]; char root_password[STRING_SIZE]; char admin_password[STRING_SIZE]; - char restore_file[STRING_SIZE]; + char restore_file[STRING_SIZE] = ""; findkey(unattendedkv, "DOMAINNAME", domainname); findkey(unattendedkv, "HOSTNAME", hostname); @@ -131,7 +131,7 @@ int unattended_setup(struct keyvalue *unattendedkv) { /* set root password */ fprintf(flog, "unattended: setting root password\n"); snprintf(commandstring, STRING_SIZE, - "/sbin/chroot /harddisk /bin/sh -c \"echo 'root:%s' | /usr/sbin/chpasswd\"", root_password); + "/usr/sbin/chroot /harddisk /bin/sh -c \"echo 'root:%s' | /usr/sbin/chpasswd\"", root_password); if (mysystem(commandstring)) { errorbox("unattended: ERROR setting root password"); return 0; @@ -140,20 +140,19 @@ int unattended_setup(struct keyvalue *unattendedkv) { /* set admin password */ fprintf(flog, "unattended: setting admin password\n"); snprintf(commandstring, STRING_SIZE, - "/sbin/chroot /harddisk /usr/sbin/htpasswd -c -m -b " CONFIG_ROOT "/auth/users admin '%s'", admin_password); + "/usr/sbin/chroot /harddisk /usr/sbin/htpasswd -c -m -b " CONFIG_ROOT "/auth/users admin '%s'", admin_password); if (mysystem(commandstring)) { errorbox("unattended: ERROR setting admin password"); return 0; } /* restore backup */ - if (restore_file != "") { + if (strlen(restore_file) > 0) { fprintf(flog, "unattended: Restoring Backup\n"); snprintf(commandstring, STRING_SIZE, - "cd /harddisk && /bin/tar -xvz --preserve -f /cdrom/%s", restore_file); + "/usr/sbin/chroot /harddisk /bin/tar -xvzp -f /var/ipfire/backup/%s -C /", restore_file); if (mysystem(commandstring)) { - errorbox("unattended: ERROR setting admin password"); - return 0; + errorbox("unattended: ERROR restoring backup"); } }