common: Factor out function to get OS name
authorJan Kara <jack@suse.cz>
Mon, 21 Dec 2015 06:07:48 +0000 (17:07 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 21 Dec 2015 06:07:48 +0000 (17:07 +1100)
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Dave Chinner <david@fromorbit.com>
common/rc

index dd50aa907835e58c583c25bd73e10c289c5ee929..c2b20da79bad11496cc7229f853382ea67fa1e3a 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2188,6 +2188,18 @@ _full_platform_details()
      echo "$os/$platform $host $kernel"
 }
 
+_get_os_name()
+{
+       if [ "`uname`" == "IRIX64" ] || [ "`uname`" == "IRIX" ]; then
+               echo 'irix'
+       elif [ "`uname`" == "Linux" ]; then
+               echo 'linux'
+       else
+               echo Unknown operating system: `uname`
+               exit
+       fi
+}
+
 _link_out_file()
 {
        if [ -z "$1" -o -z "$2" ]; then
@@ -2195,14 +2207,8 @@ _link_out_file()
                exit
        fi
        rm -f $2
-       if [ "`uname`" == "IRIX64" ] || [ "`uname`" == "IRIX" ]; then
-               ln -s $1.irix $2
-       elif [ "`uname`" == "Linux" ]; then
-               ln -s $1.linux $2
-       else
-               echo Error test $seq does not run on the operating system: `uname`
-               exit
-       fi
+       SUFFIX=$(_get_os_name())
+       ln -s $1.$SUFFIX $2
 }
 
 _die()