diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-05-28 10:04:55 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-05-28 10:04:55 -0500 |
commit | a52fcf56f737c6fc962c12efad1b637521cc5685 (patch) | |
tree | b476410bcc711942de8bf11e84a750596070d7b7 /hscript | |
parent | dc17b3db4959a34ba9768f4dd69933597e01f134 (diff) | |
download | horizon-a52fcf56f737c6fc962c12efad1b637521cc5685.tar.gz horizon-a52fcf56f737c6fc962c12efad1b637521cc5685.tar.bz2 horizon-a52fcf56f737c6fc962c12efad1b637521cc5685.tar.xz horizon-a52fcf56f737c6fc962c12efad1b637521cc5685.zip |
hscript: user: Support cross-arch installs
Using PAM's -R tries to load target system's PAM libraries,
which obviously fail if it's not the same CPU arch.
Diffstat (limited to 'hscript')
-rw-r--r-- | hscript/user.cc | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/hscript/user.cc b/hscript/user.cc index ae2b99c..571ebc4 100644 --- a/hscript/user.cc +++ b/hscript/user.cc @@ -221,9 +221,9 @@ bool Username::execute() const { } #ifdef HAS_INSTALL_ENV - if(run_command("useradd", {"-c", "Adélie User", "-m", - "-R", script->targetDirectory(), - "-U", _value}) != 0) + if(run_command("chroot", {script->targetDirectory(), "useradd", + "-c", "Adélie User", "-m", + "-U", _value}) != 0) { output_error(pos, "username: failed to create user account", _value); return false; @@ -264,8 +264,8 @@ bool UserAlias::execute() const { } #ifdef HAS_INSTALL_ENV - if(run_command("usermod", {"-c", _alias, "-R", script->targetDirectory(), - _username}) != 0) { + if(run_command("chroot", {script->targetDirectory(), "usermod", + "-c", _alias, _username}) != 0) { output_error(pos, "useralias: failed to change GECOS for " + _username); return false; } @@ -312,9 +312,8 @@ bool UserPassphrase::execute() const { } #ifdef HAS_INSTALL_ENV - if(run_command("usermod", {"-p", _passphrase, - "-R", script->targetDirectory(), - _username}) != 0) { + if(run_command("chroot", {script->targetDirectory(), "usermod", + "-p", _passphrase, _username}) != 0) { output_error(pos, "userpw: failed to set passphrase for " + _username); return false; } @@ -463,9 +462,8 @@ bool UserGroups::execute() const { } #ifdef HAS_INSTALL_ENV - if(run_command("usermod", {"-a", "-G", groups, - "-R", script->targetDirectory(), - _username}) != 0) { + if(run_command("chroot", {script->targetDirectory(), "usermod", + "-a", "-G", groups, _username}) != 0) { output_error(pos, "usergroups: failed to add groups to " + _username); return false; } |