Magellan Linux

Contents of /mcore-src/trunk/mcore-tools/src/modules/basic-version/version.client.class.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2699 - (show annotations) (download)
Wed Dec 16 14:11:07 2015 UTC (8 years, 4 months ago) by niro
File size: 973 byte(s)
-added netboot detection
1 # $Id$
2
3 provide basic-version
4
5 help_version_os()
6 {
7 mecho "get version.os"
8 mecho " Prints the current os version."
9 }
10
11 help_version_tools()
12 {
13 mecho "get version.tools"
14 mecho " Prints the current mcore-tools version."
15 }
16
17 help_version_netboot()
18 {
19 mecho "get version.netboot"
20 mecho " Prints the current netboot state."
21 }
22
23 get_version_os()
24 {
25 local version
26
27 if [ -f /etc/os-release ]
28 then
29 version="$(source /etc/os-release; echo ${Version_ID})"
30 fi
31
32 if [[ -z ${version} ]]
33 then
34 version="UNKNOWN"
35 fi
36
37 rvecho "${version}"
38 }
39
40 get_version_tools()
41 {
42 local version
43
44 if [ -f ${MCORE_LIBDIR}/VERSION ]
45 then
46 version="$(<${MCORE_LIBDIR}/VERSION)"
47 fi
48
49 if [[ -z ${version} ]]
50 then
51 version="UNKNOWN"
52 fi
53
54 rvecho "${version}"
55 }
56
57 get_version_netboot()
58 {
59 local netboot
60 local i
61
62 # default no netboot
63 netboot=0
64
65 if [ -f /proc/cmdline ]
66 then
67 for i in $(< /proc/cmdline)
68 do
69 case ${i} in
70 rd.netboot) netboot=1 ;;
71 esac
72 done
73 fi
74
75 rvecho "${netboot}"
76 }