diff mbox series

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

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

Commit Message

Sam Mendoza-Jonas June 28, 2018, 6:41 a.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

Patch

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