Skip to content

Commit

Permalink
avoid absolute path names in commands
Browse files Browse the repository at this point in the history
  • Loading branch information
wfeldt committed Nov 24, 2015
1 parent bb59a5e commit 4202949
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions scripts/save_y2logs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#
# Author: Stefan Hundhammer <sh@suse.de>

PATH=/usr/sbin:/usr/bin:/sbin:/bin

usage()
{
echo "Usage: ${0##*/} [ARCHIVE_NAME]" >&2
Expand All @@ -16,13 +18,13 @@ usage()

if test -z "$1"; then
# choose some good default
if [ -x /usr/bin/xz ] ; then
if [ "$(type -p xz)" ] ; then
SUFFIX=.tar.xz
COMPRESSION=xz
elif [ -x /usr/bin/gzip ] ; then
elif [ "$(type -p gzip)" ] ; then
SUFFIX=.tar.gz
COMPRESSION=gzip
elif [ -x /usr/bin/bzip2 ] ; then
elif [ "$(type -p bzip2)" ] ; then
SUFFIX=.tar.bz2
COMPRESSION=bzip2
else
Expand Down Expand Up @@ -72,12 +74,12 @@ TMPDIR=`mktemp -d` || ( echo "FATAL: Failed to create a temporary directory" >&2
# 1. gather some information in $TMPDIR

# last kernel messages, if any
if [ -x /bin/dmesg ]; then
if [ "$(type -p dmesg)" ]; then
dmesg > $TMPDIR/dmesg
LIST_TMP="$LIST_TMP dmesg"
fi

if [ -x /usr/bin/journalctl ]; then
if [ "$(type -p journalctl)" ]; then
journalctl --dmesg > $TMPDIR/journalctl-dmesg
LIST_TMP="$LIST_TMP journalctl-dmesg"
fi
Expand All @@ -95,7 +97,7 @@ if [ -f /mnt/var/log/pbl.log ]; then
fi

# installed packages
if [ -f /var/lib/rpm/Packages ]; then
if [ -f /var/lib/rpm/Packages -a "$(type -p rpm)" ]; then
rpm -qa --qf '%{NAME}-%{VERSION}-%{RELEASE}\t\t\t(%{VENDOR})\t%{DISTRIBUTION}\n' 2>/dev/null | sort >/$TMPDIR/rpm-qa
LIST_TMP="$LIST_TMP rpm-qa"
fi
Expand Down

0 comments on commit 4202949

Please sign in to comment.