Extra files for linux support · KcsDev1982/sunbelt-plb-samples@fd75fc8 · GitHub
Skip to content

Commit fd75fc8

Browse files
committed
Extra files for linux support
Script for linux to insure that a command has the necessary libraries installed
1 parent 83a29f0 commit fd75fc8

3 files changed

Lines changed: 226 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions

linux_extras/checklib.sh

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#
2+
# Use the 'ldd' command to verify 'shared libraries' exist.
3+
#
4+
5+
#
6+
# Is an input file name used?
7+
#
8+
9+
arg1="unixinst"
10+
11+
if [ -z "$1" ]; then
12+
echo
13+
echo "Checking '$arg1' by default!"
14+
else
15+
arg1="$1"
16+
echo
17+
echo "Checking '$arg1' binary file!"
18+
fi
19+
20+
rm checklib.out 2> /dev/null
21+
22+
#
23+
# Verify that the file to be checked exists and is an ELF
24+
# binary executable which can be checked with 'ldd'.
25+
#
26+
27+
if [ ! -f $arg1 ]; then
28+
echo
29+
echo "The '$arg1' binary exist does not exist!!"
30+
echo "Exiting script!"
31+
echo
32+
exit 1;
33+
elif [ -x "$arg1" ] && file "$arg1" | grep -q 'ELF'; then
34+
echo
35+
echo "The '$arg1' file is an ELF binary executable ok for 'ldd' check!!"
36+
else
37+
echo
38+
echo "The '$arg1' file is not an ELF binary executable!!"
39+
echo "Exiting script!"
40+
echo
41+
exit 1;
42+
fi
43+
44+
#
45+
# Check the binary file.
46+
#
47+
48+
echo
49+
ldd $arg1 > checklib.out
50+
51+
#
52+
# Verify the 'ldd' results.
53+
#
54+
55+
if [ ! -f checklib.out ]; then
56+
status=2
57+
else
58+
cat checklib.out | grep "not found"
59+
status=$?
60+
fi
61+
62+
#
63+
# $status Values
64+
#
65+
# 0 --> Missing 'shared libraries'.
66+
# 1 --> All 'share libraries' are ok!
67+
# 2 --> Error processing the 'checklib.out' file.
68+
#
69+
70+
if [ $status = 2 ]
71+
then
72+
echo
73+
echo "Unable to verify that the required 'shared libraries' are"
74+
echo "installed/available on this OS system which allows the binary files"
75+
echo "to execute."
76+
echo
77+
78+
ldd $arg1
79+
80+
echo
81+
echo "Exiting with an error!"
82+
echo
83+
exit 2;
84+
85+
elif [ $status = 0 ]
86+
then
87+
88+
echo
89+
echo "The 'shared libraries' required to execute the '$arg1' binary"
90+
echo "file is NOT installed/available on this OS system!"
91+
echo
92+
93+
ldd $arg1
94+
95+
echo
96+
echo "Exiting with an error!"
97+
echo
98+
exit 3;
99+
100+
else
101+
102+
echo
103+
echo "The 'shared libraries' required to execute the '$arg1' binary"
104+
echo "file is installed/available on this OS system!"
105+
echo
106+
107+
ldd $arg1
108+
109+
echo
110+
echo "Exiting OK!"
111+
echo
112+
exit 0;
113+
114+
fi
115+

linux_extras/unixinstall.txt

Lines changed: 110 additions & 0 deletions

0 commit comments

Comments
 (0)