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)
This commit is contained in:
parent
a73ed74337
commit
0835a1065f
2 changed files with 4 additions and 2 deletions
|
@ -619,11 +619,13 @@ create-sbu_du-report: mk_BOOT
|
|||
|
||||
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; \\
|
||||
|
|
|
@ -36,7 +36,7 @@ crLOGDIR = /\$(SCRIPT_ROOT)/$LOGDIRBASE
|
|||
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"
|
||||
|
|
Reference in a new issue