This repository has been archived by the owner on Jun 24, 2021. It is now read-only.
forked from eeertekin/bbcp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakeSname
executable file
·96 lines (85 loc) · 2.73 KB
/
MakeSname
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
# (C) 2010 by the Board of Trustees of the Leland Stanford, Jr., University
# All Rights Reserved
# Produced by Andrew Hanushevsky for Stanford University under contract
# DE-AC03-76-SFO0515 with the Deprtment of Energy
# Establish things we will look for
#
AFSFS=/usr/afsws/bin/fs
UNAME=/bin/uname
UNAMF=/usr/bin/uname
VERBOSE=0
##############################################################################
# s u b r o u t i n e s #
##############################################################################
Debug () {
if test $VERBOSE -eq 1; then
/bin/echo $1
fi
}
FileThere () {
Debug "Checking file $2 ..."
if test -${1} $2; then
return 0
fi
return 1
}
##############################################################################
# m a i n p r o g r a m #
##############################################################################
# Get the uname characteristics
#
if FileThere x $UNAME; then
OSNAME=`$UNAME`
RLNAME=`$UNAME -r`
MTNAME=`$UNAME -m`
elif FileThere x $UNAMF; then
OSNAME=`$UNAMF`
RLNAME=`$UNAMF -r`
MTNAME=`$UNAMF -m`
fi
# If the AFS fs command exists, then this becomes the system name
#
if FileThere x $AFSFS; then
SYSNAME=`$AFSFS sysname | /usr/bin/awk -F\' '{print $2}'`
if [ $SYSNAME = i386_rhel40 ]; then
if [ "x$MTNAME" = "xx86_64" ]; then
SYSNAME=amd64_linux26
else
SYSNAME=i386_linux26
fi
fi
elif [ $OSNAME = SunOS ]; then
if [ $MTNAME = i86pc ]; then
SYSNAME=sunx86
else
case $RLNAME in 5.6) RFX=56 ;; 5.7) RFX=57 ;; 5.8) RFX=58 ;; 5.9) RFX=59 ;; esac
SYSNAME=sun4x_$RFX
fi
elif [ $OSNAME = Linux ]; then
case $RLNAME in 2.4*) RFX=24 ;; 2.6*) RFX=26 ;; esac
PFX=i386
case $MTNAME in i*) PFX=i386 ;; x86_64) PFX=amd64 ;; esac
SYSNAME=${PFX}_linux$RFX
elif [ $OSNAME = FreeBSD ]; then
case $RLNAME in 4.2*) RFX=42 ;; 4.3*) RFX=43 ;; 4.4*) RFX=44 ;; esac
SYSNAME=FreeBSD$RFX
elif [ $OSNAME = Darwin ]; then
case $RLNAME in 8*) RFX=80 ;; 9*) RFX=90 ;; 10*) RFX=100 ;; esac
case $MTNAME in ppc*) PFX=ppc ;; i386*) PFX=X86 ;; esac
SYSNAME=${PFX}_darwin_$RFX
elif [ $OSNAME = AIX ]; then
case $RLNAME in 2) RFX=42 ;; 3) RFX=43 ;; 4) RFX=44 ;; esac
SYSNAME=rs_aix$RFX
else
SYSNAME=misc
fi
if FileThere d ../obj/$SYSNAME; then :
else
/bin/mkdir -p ../obj/$SYSNAME
fi
if FileThere d ../bin/$SYSNAME; then :
else
/bin/mkdir -p ../bin/$SYSNAME
fi
echo $SYSNAME