소스 검색

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 #18
fixes #181
fixes #306
classabbyamp 2 년 전
부모
커밋
e8f015ce55
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      installer.sh.in

+ 3 - 3
installer.sh.in

@@ -660,7 +660,7 @@ menu_rootpassword() {
 }
 
 set_rootpassword() {
-    echo "root:$(get_option ROOTPASSWORD)" | chpasswd -R $TARGETDIR -c SHA512
+    echo "root:$(get_option ROOTPASSWORD)" | chroot $TARGETDIR chpasswd -c SHA512
 }
 
 menu_useraccount() {
@@ -769,10 +769,10 @@ set_useraccount() {
     [ -z "$USERPASSWORD_DONE" ] && return
     [ -z "$USERNAME_DONE" ] && return
     [ -z "$USERGROUPS_DONE" ] && return
-    useradd -R "$TARGETDIR" -m -G "$(get_option USERGROUPS)" \
+    chroot $TARGETDIR useradd -m -G "$(get_option USERGROUPS)" \
         -c "$(get_option USERNAME)" "$(get_option USERLOGIN)"
     echo "$(get_option USERLOGIN):$(get_option USERPASSWORD)" | \
-        chpasswd -R $TARGETDIR -c SHA512
+        chroot $TARGETDIR chpasswd -c SHA512
 }
 
 menu_bootloader() {