diff mbox series

[02/13] utils/pb-sos: Don't create files in root by default

Message ID 20181122233630.6303-3-sam@mendozajonas.com
State Superseded
Headers show
Series User support and client permissions | expand

Commit Message

samjonas Nov. 22, 2018, 11:36 p.m. UTC
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@mendozajonas.com>
 utils/pb-sos | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
diff mbox series


diff --git a/utils/pb-sos b/utils/pb-sos
index e3e8f6bb..44dcabd7 100755
--- a/utils/pb-sos
+++ b/utils/pb-sos
@@ -43,32 +43,31 @@  do
-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 ]
 	log "Adding core dump"
-	cp /core /$diagdir/
+	cp /core $diagdir/
 # 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