forked from Zomojo/compiletools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cake-config-chooser
executable file
·44 lines (35 loc) · 955 Bytes
/
cake-config-chooser
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
#!/bin/sh
# Figure out which cake config is appropriate to use
DISTRIBUTOR_ID=""
# Linux:
# Use /etc/os-release but fall back to lsb_release
if [ -s /etc/os-release ]; then
. /etc/os-release
echo etc.cake.$ID.$VERSION_ID
exit 0
fi
which lsb_release >/dev/null 2>/dev/null
if [ "0" = "$?" ]; then
DISTRIBUTOR_ID=$(lsb_release -i | cut -f2 |tr -d '\n')
MAJOR_RELEASE=$(lsb_release -r | cut -f2 | cut -d. -f1)
if [ "CentOS" = "$DISTRIBUTOR_ID" ]; then
echo etc.cake.centos.$MAJOR_RELEASE
exit 0
fi
if [ "Fedora" = "$DISTRIBUTOR_ID" ]; then
echo etc.cake.fedora.$MAJOR_RELEASE
exit 0
fi
if [ "Scientific" = "$DISTRIBUTOR_ID" ]; then
echo etc.cake.scientific.$MAJOR_RELEASE
exit 0
fi
fi
# Darwin
# FreeBSD
if [ "FreeBSD" = $(uname -o) ]; then
MAJOR_RELEASE=$(uname -r| cut -d- -f1)
echo etc.cake.freebsd.$MAJOR_RELEASE
exit 0
fi
# Solaris