Skip to content

Commit e8f015c

Browse files
committed
installer: use chroot instead of -R arg for useradd/chpasswd
this should mitigate/resolve issues where mismatches between host and TARGETDIR cause errors when adding the primary user fixes void-linux#18 fixes void-linux#181 fixes void-linux#306
1 parent a94eb3b commit e8f015c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

installer.sh.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ menu_rootpassword() {
660660
}
661661

662662
set_rootpassword() {
663-
echo "root:$(get_option ROOTPASSWORD)" | chpasswd -R $TARGETDIR -c SHA512
663+
echo "root:$(get_option ROOTPASSWORD)" | chroot $TARGETDIR chpasswd -c SHA512
664664
}
665665

666666
menu_useraccount() {
@@ -769,10 +769,10 @@ set_useraccount() {
769769
[ -z "$USERPASSWORD_DONE" ] && return
770770
[ -z "$USERNAME_DONE" ] && return
771771
[ -z "$USERGROUPS_DONE" ] && return
772-
useradd -R "$TARGETDIR" -m -G "$(get_option USERGROUPS)" \
772+
chroot $TARGETDIR useradd -m -G "$(get_option USERGROUPS)" \
773773
-c "$(get_option USERNAME)" "$(get_option USERLOGIN)"
774774
echo "$(get_option USERLOGIN):$(get_option USERPASSWORD)" | \
775-
chpasswd -R $TARGETDIR -c SHA512
775+
chroot $TARGETDIR chpasswd -c SHA512
776776
}
777777

778778
menu_bootloader() {

0 commit comments

Comments
 (0)