Author: pierre
Date: Wed Apr  1 02:11:32 2020
New Revision: 4148

Log:
Two fixes:"
- use /etc/passwd to check whether LUSER exists
- use sudo -H -u $(LUSER) to be sure that HOME is set (depends on distro)

Modified:
   jhalfs/trunk/LFS/master.sh
   jhalfs/trunk/common/libs/func_wrt_Makefile

Modified: jhalfs/trunk/LFS/master.sh
==============================================================================
--- jhalfs/trunk/LFS/master.sh  Tue Mar 31 01:47:52 2020        (r4147)
+++ jhalfs/trunk/LFS/master.sh  Wed Apr  1 02:11:32 2020        (r4148)
@@ -619,11 +619,13 @@
 
 save-luser:
        @\$(call echo_message, Building)
-       @if lslogins \$(LUSER) > luser-id 2>/dev/null; then  \\
+       @LUSER_ID=\$(grep '^$(LUSER):' /etc/passwd | cut -d: -f3); \\
+       if [ -n "\$LUSER_ID" ]; then  \\
            if [ ! -d \$(LUSER_HOME).XXX ]; then \\
                mv \$(LUSER_HOME){,.XXX}; \\
                mkdir \$(LUSER_HOME); \\
                chown \$(LUSER):\$(LGROUP) \$(LUSER_HOME); \\
+               echo "\$LUSER_ID" > luser-id; \\
            fi; \\
        else \\
                rm luser-id; \\

Modified: jhalfs/trunk/common/libs/func_wrt_Makefile
==============================================================================
--- jhalfs/trunk/common/libs/func_wrt_Makefile  Tue Mar 31 01:47:52 2020        
(r4147)
+++ jhalfs/trunk/common/libs/func_wrt_Makefile  Wed Apr  1 02:11:32 2020        
(r4148)
@@ -36,7 +36,7 @@
 crTESTLOGDIR   = /\$(SCRIPT_ROOT)/$TESTLOGDIRBASE
 crFILELOGDIR   = /\$(SCRIPT_ROOT)/$FILELOGDIRBASE
 
-SU_LUSER       = sudo -u \$(LUSER) sh -c
+SU_LUSER       = sudo -H -u \$(LUSER) sh -c
 LUSER_HOME     = \$(LHOME)/\$(LUSER)
 PRT_DU         = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) 
--exclude=lost+found \$(MOUNT_PT) \`\n"
 PRT_DU_CR      = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) 
--exclude=lost+found --exclude /var/lib / \`\n"
-- 
http://lists.linuxfromscratch.org/listinfo/alfs-log
Unsubscribe: See the above information page

Reply via email to