start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
start fs2ost $fs2ostdev $OST_MOUNT_OPTS
mkdir -p $MOUNT2
- mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
+ $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || return 1
# 1 still works
check_mount || return 2
# files written on 1 should not show up on 2
run_test 30b "Remove failover nids"
test_31() { # bug 10734
- # ipaddr must not exist
- mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
+ # ipaddr must not exist
+ $MOUNT_CMD 4.3.2.1@tcp:/lustre $MOUNT || true
cleanup
}
run_test 31 "Connect to non-existent node (shouldn't crash)"
if [ $fstype == "ldiskfs" ]; then
mopts="loop,$mopts"
fi
- $r mount -t lustre -o $mopts $mdt_dev $tmp/mnt/mdt
+ $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt
$r lctl replace_nids $fsname-OST0000 $ostnid
$r lctl replace_nids $fsname-MDT0000 $nid
$r umount -d $tmp/mnt/mdt
t32_wait_til_devices_gone $node
- $r mount -t lustre -o $mopts $mdt_dev $tmp/mnt/mdt || {
+ $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
$r losetup -a
error_noexit "Mounting the MDT"
return 1
echo "mount new MDT....$fs2mdsdev"
$r mkdir -p $tmp/mnt/mdt1
- $r mount -t lustre -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
+ $r $MOUNT_CMD -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
error_noexit "mount mdt1 failed"
return 1
}
mopts="loop,$mopts"
fi
fi
- $r mount -t lustre -o $mopts $ost_dev $tmp/mnt/ost || {
+ $r $MOUNT_CMD -o $mopts $ost_dev $tmp/mnt/ost || {
error_noexit "Mounting the OST"
return 1
}
fi
if [ "$writeconf" ]; then
- mount -t lustre $nid:/$fsname $tmp/mnt/lustre || {
+ $MOUNT_CMD $nid:/$fsname $tmp/mnt/lustre || {
error_noexit "Mounting the client"
return 1
}
if [ $fstype == "ldiskfs" ]; then
mopts="loop,$mopts"
fi
- $r mount -t lustre -o $mopts $mdt_dev $tmp/mnt/mdt || {
+ $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
error_noexit "Remounting the MDT"
return 1
}
start fs2ost $fs2ostdev $OST_MOUNT_OPTS
do_facet $SINGLEMDS "$LCTL conf_param $FSNAME2.sys.timeout=200" || rc=1
mkdir -p $MOUNT2
- mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
+ $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
echo "ok."
cp /etc/hosts $MOUNT2/ || rc=3
start fs2ost $fs2ostdev $OST_MOUNT_OPTS
start fs3ost $fs3ostdev $OST_MOUNT_OPTS
mkdir -p $MOUNT2
- mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
+ $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || return 1
sleep 5 # until 11778 fixed
start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
mkdir -p $MOUNT2
- mount -t lustre $mgsnid:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
+ $MOUNT_CMD $mgsnid:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
cleanup_24a
}
DBENCH_TIME=${DBENCH_TIME:-60} # No of seconds to run dbench
TGT=$TMP/target
TGT2=$TMP/target2
-MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid | \
- awk '{gsub(/_UUID/,""); print $1}' | head -1)
+MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid |
+ awk '{ gsub(/_UUID/,""); print $1 }' | head -n1)
init_changelog() {
CL_USER=$(do_facet $SINGLEMDS lctl --device $MDT0 changelog_register -n)
local varsvc=${facet}_svc
local dev=$(ldiskfs_canon "*.${!varsvc}.mntdev" $facet)
- # ext4: /proc/fs/jbd2/sda1:8/history
+ # ext4: /proc/fs/jbd2/sda1:8/history
# ext3: /proc/fs/jbd/sdb1/history
do_facet $facet cat /proc/fs/jbd*/${dev}*/$file
# $8: hndls >= thrhi * 2
# display history of rtime/4 before, in case obd cleanup consumes time
local tlines=$((rtime / 5 / 4 + 1))
- local hist=("$(print_jbd history $facet | tail -$tlines | head -1)")
+ local hist=("$(print_jbd history $facet | tail -$tlines | head -n1)")
echo "$hist"
local run=($(echo "${hist[*]}" | awk '{print $4}'))
local hndls=($(echo "${hist[*]}" | awk '{print $8}'))
}
check_dir_not_in_pool() {
- local dir=$1
- local pool=$2
- local res=$($GETSTRIPE -v $dir | grep "^stripe_count" | head -1 |
- cut -f 8 -d ' ')
- if [[ "$res" == "$pool" ]]; then
- error "File $dir is in pool: $res"
- return 1
- fi
- return 0
+ local dir=$1
+ local pool=$2
+ local res=$($GETSTRIPE -v $dir | grep "^stripe_count" | head -n1 |
+ cut -f 8 -d ' ')
+ if [[ "$res" == "$pool" ]]; then
+ error "File $dir is in pool: $res"
+ return 1
+ fi
+ return 0
}
drain_pool() {
}
test_60() {
- MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid | \
- awk '{gsub(/_UUID/,""); print $1}' | head -1)
+ MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid |
+ awk '{ gsub(/_UUID/,""); print $1 }' | head -n1)
NUM_FILES=15000
mkdir -p $DIR/$tdir
local target=${srv}_svc
local si=$(do_facet $srv lctl get_param -n $obdname.${!target}.instance)
- local ci=$(lctl get_param -n $cliname.${!target}-${cliname}-*.import | \
- awk '/instance/{ print $2 }' |head -1)
+ local ci=$(lctl get_param -n $cliname.${!target}-${cliname}-*.import |
+ awk '/instance/{ print $2 }' | head -n1)
return $([ $si -eq $ci ])
}
}
test_5() {
- [ -z "`which iozone 2> /dev/null`" ] && skip_env "iozone missing" && return 0
+ if [ -z "`which iozone 2> /dev/null`" ]; then
+ skip_env "iozone missing"
+ return 0
+ fi
- # striping is -c 1, get min of available
- local minavail=$(lctl get_param -n osc.*[oO][sS][cC][-_]*.kbytesavail | sort -n | head -1)
- local size=$(( minavail * 3/4 ))
- local GB=1048576 # 1048576KB == 1GB
+ # striping is -c 1, get min of available
+ local minavail=$(lctl get_param -n osc.*[oO][sS][cC][-_]*.kbytesavail |
+ sort -n | head -n1)
+ local size=$(( minavail * 3/4 ))
+ local GB=1048576 # 1048576KB == 1GB
- if (( size > GB )); then
- size=$GB
- fi
- local iozone_opts="-i 0 -i 1 -i 2 -+d -r 4 -s $size -f $TDIR/$tfile"
+ if (( size > GB )); then
+ size=$GB
+ fi
+ local iozone_opts="-i 0 -i 1 -i 2 -+d -r 4 -s $size -f $TDIR/$tfile"
- iozone_bg $iozone_opts &
- local pid=$!
+ iozone_bg $iozone_opts &
+ local pid=$!
- echo iozone bg pid=$pid
+ echo iozone bg pid=$pid
- sleep 8
- fail ost1
- local rc=0
- wait $pid
- rc=$?
- log "iozone rc=$rc"
- rm -f $TDIR/$tfile
- wait_delete_completed_mds
- [ $rc -eq 0 ] || error "iozone failed"
- return $rc
+ sleep 8
+ fail ost1
+ local rc=0
+ wait $pid
+ rc=$?
+ log "iozone rc=$rc"
+ rm -f $TDIR/$tfile
+ wait_delete_completed_mds
+ [ $rc -eq 0 ] || error "iozone failed"
+ return $rc
}
run_test 5 "Fail OST during iozone"
local idx=$(($mdtno - 1))
MDT[$idx]=$($LCTL get_param -n \
mdc.$FSNAME-MDT000${idx}-mdc-*.mds_server_uuid |
- awk '{gsub(/_UUID/,""); print $1}' | head -1)
+ awk '{gsub(/_UUID/,""); print $1}' | head -n1)
done
}
make_large_for_striping() {
local file2=${1/$DIR/$DIR2}
- local sz=$($LCTL get_param -n lov.*-clilov-*.stripesize | head -1)
+ local sz=$($LCTL get_param -n lov.*-clilov-*.stripesize | head -n1)
cleanup_large_files
DIR=${DIR:-$MOUNT}
assert_DIR
-MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid | \
- awk '{gsub(/_UUID/,""); print $1}' | head -1)
+MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid |
+ awk '{ gsub(/_UUID/,""); print $1 }' | head -n1)
LOVNAME=$($LCTL get_param -n llite.*.lov.common_name | tail -n 1)
OSTCOUNT=$($LCTL get_param -n lov.$LOVNAME.numobd)
STRIPECOUNT=$($LCTL get_param -n lov.$LOVNAME.stripecount)
run_test 17i "don't panic on short symlink"
test_17k() { #bug 22301
- rsync --help | grep -q xattr ||
- skip_env "$(rsync --version| head -1) does not support xattrs"
- [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ rsync --help | grep -q xattr ||
+ skip_env "$(rsync --version | head -n1) does not support xattrs"
+ [ $PARALLEL == "yes" ] && skip "skip parallel run" && return 0
test_mkdir -p $DIR/$tdir
test_mkdir -p $DIR/$tdir.new
touch $DIR/$tdir/$tfile
}
max_pages_per_rpc() {
- $LCTL get_param -n mdc.*.max_pages_per_rpc | head -1
+ $LCTL get_param -n mdc.*.max_pages_per_rpc | head -n1
}
test_24v() {
[ $F78SIZE -gt $MEMTOTAL ] && F78SIZE=$MEMTOTAL
[ $F78SIZE -gt 512 ] && F78SIZE=512
[ $F78SIZE -gt $((MAXFREE / 1024)) ] && F78SIZE=$((MAXFREE / 1024))
- SMALLESTOST=`lfs df $DIR |grep OST | awk '{print $4}' |sort -n |head -1`
+ SMALLESTOST=$(lfs df $DIR | grep OST | awk '{ print $4 }' | sort -n |
+ head -n1)
echo "Smallest OST: $SMALLESTOST"
[ $SMALLESTOST -lt 10240 ] && \
skip "too small OSTSIZE, useless to run large O_DIRECT test" && return 0
[ "$SLOW" = "no" ] && NSEQ=1 && [ $F78SIZE -gt 32 ] && F78SIZE=32
echo "File size: $F78SIZE"
$SETSTRIPE -c $OSTCOUNT $DIR/$tfile || error "setstripe failed"
- for i in `seq 1 $NSEQ`
- do
- FSIZE=$(($F78SIZE / ($NSEQ - $i + 1)))
- echo directIO rdwr round $i of $NSEQ
- $DIRECTIO rdwr $DIR/$tfile 0 $FSIZE 1048576||error "rdwr failed"
- done
+ for i in `seq 1 $NSEQ`
+ do
+ FSIZE=$(($F78SIZE / ($NSEQ - $i + 1)))
+ echo directIO rdwr round $i of $NSEQ
+ $DIRECTIO rdwr $DIR/$tfile 0 $FSIZE 1048576||error "rdwr failed"
+ done
rm -f $DIR/$tfile
}
echo -n "Free space priority "
do_facet $SINGLEMDS lctl get_param -n lo*.*-mdtlov.qos_prio_free |
- head -1
+ head -n1
declare -a AVAIL
free_min_max
local DIFF2=$(($DIFF * 100 / $MINV))
local threshold=$(do_facet $SINGLEMDS \
- lctl get_param -n *.*MDT0000-mdtlov.qos_threshold_rr | head -1)
+ lctl get_param -n *.*MDT0000-mdtlov.qos_threshold_rr | head -n1)
threshold=${threshold%%%}
echo -n "Check for uneven OSTs: "
echo -n "diff=${DIFF}KB (${DIFF2}%) must be > ${threshold}% ..."
export OLD_RESENDCOUNT=""
set_resend_count () {
local PROC_RESENDCOUNT="osc.${FSNAME}-OST*-osc-*.resend_count"
- OLD_RESENDCOUNT=$(lctl get_param -n $PROC_RESENDCOUNT | head -1)
+ OLD_RESENDCOUNT=$(lctl get_param -n $PROC_RESENDCOUNT | head -n1)
lctl set_param -n $PROC_RESENDCOUNT $1
echo resend_count is set to $(lctl get_param -n $PROC_RESENDCOUNT)
}
MIN_REC=$($GET_CL_USERS |
awk 'min == "" || $2 < min {min = $2}; END {print min}')
- FIRST_REC=$($LFS changelog $MDT0 | head -1 | awk '{print $1}')
+ FIRST_REC=$($LFS changelog $MDT0 | head -n1 | awk '{print $1}')
echo "verifying min purge: $(( $MIN_REC + 1 )) == $FIRST_REC"
[ $FIRST_REC == $(($MIN_REC + 1)) ] ||
err17935 "first index should be $(($MIN_REC + 1)) is $FIRST_REC"
# LU-3446 changelog index reset on MDT restart
local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
- CUR_REC1=$($GET_CL_USERS | head -1 | cut -f3 -d' ')
+ CUR_REC1=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
$LFS changelog_clear $MDT0 $USER 0
stop $SINGLEMDS || error "Fail to stop MDT."
start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "Fail to start MDT."
- CUR_REC2=$($GET_CL_USERS | head -1 | cut -f3 -d' ')
+ CUR_REC2=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
echo "verifying index survives MDT restart: $CUR_REC1 == $CUR_REC2"
[ $CUR_REC1 == $CUR_REC2 ] ||
err17935 "current index should be $CUR_REC1 is $CUR_REC2"
USERS=$(( $($GET_CL_USERS | wc -l) - 2 ))
if [ $USERS -eq 0 ]; then
- LAST_REC1=$($GET_CL_USERS | head -1 | cut -f3 -d' ')
+ LAST_REC1=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
touch $DIR/$tdir/chloe
- LAST_REC2=$($GET_CL_USERS | head -1 | cut -f3 -d' ')
+ LAST_REC2=$($GET_CL_USERS | head -n1 | cut -f3 -d' ')
echo "verify changelogs are off: $LAST_REC1 == $LAST_REC2"
[ $LAST_REC1 == $LAST_REC2 ] || error "changelogs not off"
else
do_rpc_nodes $(facet_active_host ost1) load_module obdecho/obdecho &&
rmmod_remote=true || error "failed to load module obdecho"
- target=$(do_facet ost1 $LCTL dl | awk '/obdfilter/ {print $4}'|head -1)
+ target=$(do_facet ost1 $LCTL dl | awk '/obdfilter/ { print $4 }' |
+ head -n1)
if [[ -n $target ]]; then
obdecho_test "$target" ost1 "$pages" ||
rc=${PIPESTATUS[0]}
local pool=$1
local pname="lov.$FSNAME-*.pools.$pool"
- local t=$($LCTL get_param -n $pname | head -1)
+ local t=$($LCTL get_param -n $pname | head -n1)
do_facet mgs $LCTL pool_remove $FSNAME.$pool $t
wait_update $HOSTNAME "lctl get_param -n $pname | grep $t" "" || {
error_noexit "$t not removed from $FSNAME.$pool"
error_noexit "Pool $FSNAME.$pool cannot be drained"
return 1
}
- # striping on an empty/nonexistant pool should fall back
+ # striping on an empty/nonexistant pool should fall back
# to "pool of everything"
touch $file || {
error_noexit "failed to use fallback striping for empty pool"
{
# For simplicity this test assumes that max_pages_per_rpc
# is the same across all OSCs
- local max_pages=$($LCTL get_param -n osc.*.max_pages_per_rpc | head -1)
+ local max_pages=$($LCTL get_param -n osc.*.max_pages_per_rpc | head -n1)
local bulk_size=$((max_pages * 4096))
mkdir -p $DIR/$tdir
test_23() { # Bug 5972
local at_diff=$(do_facet $SINGLEMDS \
- $LCTL get_param -n mdd.*MDT0000*.atime_diff | head -1)
+ $LCTL get_param -n mdd.*MDT0000*.atime_diff | head -n1)
echo "atime should be updated while another read" > $DIR1/$tfile
# clear the lock(mode: LCK_PW) gotten from creating operation
DD2_PID=$!
usleep 50
log "dd 1 started"
-
+
dd if=/dev/zero of=$DIR1/$tfile bs=$((16384-1024))k conv=notrunc count=1 seek=4 &
DD1_PID=$!
log "dd 2 started"
-
+
sleep 1
dd if=/dev/zero of=$DIR1/$tfile bs=8k conv=notrunc count=1 seek=0
log "dd 3 finished"
test_28() { # bug 9977
ECHO_UUID="ECHO_osc1_UUID"
- tOST=`$LCTL dl | | awk '/-osc-|OSC.*MNT/ { print $4 }' | head -1`
+ tOST=$($LCTL dl | awk '/-osc-|OSC.*MNT/ { print $4 }' | head -n1)
$LFS setstripe $DIR1/$tfile -S 1048576 -i 0 -c 2
tOBJID=`$LFS getstripe $DIR1/$tfile | awk '$1 == 1 {print $2}'`
varsvc=${mds}_svc
dev=$(basename $(do_facet $mds "lctl get_param -n osd*.${!varsvc}.mntdev|\
xargs readlink -f" ))
- val=$(do_facet $mds "cat /proc/fs/jbd*/${dev}{,:*,-*}/info 2>/dev/null|\
- head -1")
+ val=$(do_facet $mds "cat /proc/fs/jbd*/${dev}{,:*,-*}/info 2>/dev/null |
+ head -n1")
val=${val%% *};
stat=$(( stat + val))
done
export LOAD_LLOOP=${LOAD_LLOOP:-false}
#export PDSH="pdsh -S -Rssh -w"
+export MOUNT_CMD=${MOUNT_CMD:-"mount -t lustre"}
# function used by scripts run on remote nodes
LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
local total=
local status=Unfinished
if [ -f $log ]; then
- skipped=$(grep excluded $log | awk '{ printf " %s", $3 }' | sed 's/test_//g')
- slow=$(egrep "^PASS|^FAIL" $log | tr -d "("| sed s/s\)$//g | sort -nr -k 3 | head -5 | awk '{ print $2":"$3"s" }')
- total=$(grep duration $log | awk '{ print $2}')
- if [ "${!O}" = "done" ]; then
- status=Done
- fi
- if $DDETAILS; then
- local durations=$(egrep "^PASS|^FAIL" $log | tr -d "("| sed s/s\)$//g | awk '{ print $2":"$3"|" }')
- details=$(printf "%s\n%s %s %s\n" "$details" "DDETAILS" "$O" "$(echo $durations)")
- fi
+ skipped=$(grep excluded $log | awk '{ printf " %s", $3 }' |
+ sed 's/test_//g')
+ slow=$(egrep "^PASS|^FAIL" $log | tr -d "("| sed s/s\)$//g |
+ sort -nr -k 3 | head -n5 | awk '{ print $2":"$3"s" }')
+ total=$(grep duration $log | awk '{ print $2 }')
+ if [ "${!O}" = "done" ]; then
+ status=Done
+ fi
+ if $DDETAILS; then
+ local durations=$(egrep "^PASS|^FAIL" $log |
+ tr -d "("| sed s/s\)$//g |
+ awk '{ print $2":"$3"|" }')
+ details=$(printf "%s\n%s %s %s\n" "$details" \
+ "DDETAILS" "$O" "$(echo $durations)")
+ fi
fi
printf "$form" $status "$O" "${total}" "E=$skipped"
printf "$form" "-" "-" "-" "S=$(echo $slow)"
echo -n "$((($1 << 16) | ($2 << 8) | $3))"
}
-export LINUX_VERSION=$(uname -r | sed -e "s/[-.]/ /3" -e "s/ .*//")
+export LINUX_VERSION=$(uname -r | sed -e "s/\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/")
export LINUX_VERSION_CODE=$(version_code ${LINUX_VERSION//\./ })
module_loaded () {
if [ -f $TMP/test-lu482-trigger ]; then
RC=2
else
- do_facet ${facet} "mkdir -p $mntpt; mount -t lustre $opts \
+ do_facet ${facet} "mkdir -p $mntpt; $MOUNT_CMD $opts \
${!dev} $mntpt"
RC=${PIPESTATUS[0]}
fi
echo "Starting client: $client: $OPTIONS $device $mnt"
do_node $client mkdir -p $mnt
- do_node $client mount -t lustre $OPTIONS $device $mnt || return 1
+ do_node $client $MOUNT_CMD $OPTIONS $device $mnt || return 1
set_default_debug_nodes $client
rc=0;
if [ \\\$running -eq 0 ] ; then
mkdir -p $mnt;
- mount -t lustre $OPTIONS $device $mnt;
+ $MOUNT_CMD $OPTIONS $device $mnt;
rc=\\\$?;
fi;
exit \\\$rc" || return ${PIPESTATUS[0]}
}
setstripe_nfsserver () {
- local dir=$1
+ local dir=$1
- local nfsserver=$(awk '"'$dir'" ~ $2 && $3 ~ "nfs" && $2 != "/" \
- { print $1 }' /proc/mounts | cut -f 1 -d : | head -1)
+ local nfsserver=$(awk '"'$dir'" ~ $2 && $3 ~ "nfs" && $2 != "/" \
+ { print $1 }' /proc/mounts | cut -f 1 -d : | head -n1)
- [ -z $nfsserver ] && echo "$dir is not nfs mounted" && return 1
+ [ -z $nfsserver ] && echo "$dir is not nfs mounted" && return 1
- do_nodev $nfsserver lfs setstripe "$@"
+ do_nodev $nfsserver lfs setstripe "$@"
}
# Check and add a test group.
SECONDS=0
eval '$cmd'
-
+
[ ${PIPESTATUS[0]} -eq 0 ] || rc=1
echo $SECONDS
}
inodes_available () {
- local IFree=$($LFS df -i $MOUNT | grep ^$FSNAME | awk '{print $4}' | sort -un | head -1) || return 1
- echo $IFree
+ local IFree=$($LFS df -i $MOUNT | grep ^$FSNAME | awk '{ print $4 }' |
+ sort -un | head -n1) || return 1
+ echo $IFree
}
mdsrate_inodes_available () {
}
release() {
- if [ -r /etc/lsb-release ]; then
- dist=$(grep 'DISTRIB_ID' /etc/lsb-release | sed 's/DISTRIB_ID=//' | head -1)
- elif [ -r /etc/redhat-release ]; then
- dist=$(awk '/release/ { printf("%s %s %s", $1, $2, $3)}' /etc/redhat-release)
- elif [ -r /etc/*-release ]; then
- dist=$(find /etc/ -maxdepth 1 -name '*release' 2> /dev/null | \
- sed -e 's/\/etc\///' -e 's/-release//' | head -1)
- else
- dist="UNKNOWN"
- fi
-
- echo $dist
+ if [ -r /etc/lsb-release ]; then
+ dist=$(sed -ne '/^DISTRIB_ID/s/DISTRIB_ID=//p' /etc/lsb-release)
+ elif [ -r /etc/redhat-release ]; then
+ dist=$(awk '/release/ { printf("%s %s %s", $1, $2, $3) }' \
+ /etc/redhat-release)
+ elif [ -r /etc/*-release ]; then
+ dist=$(find /etc/ -maxdepth 1 -name '*release' 2> /dev/null |
+ sed -e 's/\/etc\///' -e 's/-release//' | head -n1)
+ else
+ dist="UNKNOWN"
+ fi
+
+ echo $dist
}
yml_build_info() {