[RFC PATCH 02/13] utils/pb-sos: Don't create files in root by default
Samuel Mendoza-Jonas
sam at mendozajonas.com
Thu Jun 28 16:41:40 AEST 2018
If running in a non-root shell the user will not be able to create or
access files in / so operate in the current directory instead.
Signed-off-by: Samuel Mendoza-Jonas <sam at mendozajonas.com>
---
utils/pb-sos | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/utils/pb-sos b/utils/pb-sos
index e3e8f6b..44dcabd 100755
--- a/utils/pb-sos
+++ b/utils/pb-sos
@@ -43,32 +43,31 @@ do
shift
done
-mkdir -p /$diagdir
+mkdir -p $diagdir
# Include version of pb-discover
-pb-discover --version > /$diagdir/version
+pb-discover --version > $diagdir/version
# Unconditionally grab relevant /var/log files
log "Adding files from /var/log"
-cp -r /var/log/messages /var/log/petitboot /$diagdir/
+cp -r /var/log/messages /var/log/petitboot $diagdir/
# Check if pb-discover segfaulted
if [ -r $corefile ]
then
log "Adding core dump"
- cp /core /$diagdir/
+ cp /core $diagdir/
fi
# Copy dmesg
log "Adding dmesg"
-dmesg > /$diagdir/dmesg
+dmesg > $diagdir/dmesg
# Add Skiboot log
log "Adding Skiboot log"
-cat /sys/firmware/opal/msglog > /$diagdir/msglog
+cat /sys/firmware/opal/msglog > $diagdir/msglog
log "Compressing..."
-cd /
tar $tarflags $tarfile $diagdir
gzip < $tarfile > $tarfile.gz
--
2.18.0
More information about the Petitboot
mailing list