File: sys

package info (click to toggle)
golf 601.4.41-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,824 kB
  • sloc: ansic: 20,020; sh: 1,171; makefile: 292
file content (77 lines) | stat: -rwxr-xr-x 1,872 bytes parent folder | download
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
#!/bin/bash
#SPDX-License-Identifier: Apache-2.0
#Copyright 2018-2025 Gliim LLC. 
#Licensed under Apache License v2. See LICENSE file.
#On the web http://golf-lang.com/ - this file is part of Golf framework.


# Set variables for building and installing a Golf application. 
# If your system doesn't conform, you can change these variables to fit

function lowest_version() { 
    echo "$@" | sed 's/ /\n/g'| sort -V | head -n 1 
}

#utility to check for versions matching
if [ "$1" == "greater_than_eq" ]; then
    L=$(lowest_version "$2" "$3" )
    if [ "$L" == "$3" ]; then echo "1"; else echo "0"; fi
    exit 0
fi

#do not do all twice if already done
if [ "$GG_SYSTEM_DONE" != "1" ]; then

#determine operating system, some don't have /etc/os-release (or it isn't linked), try the alternative
    if [ -f "/etc/os-release" ]; then
        . /etc/os-release
    elif [ -f "/usr/lib/os-release" ]; then
        . /usr/lib/os-release
    elif [ -f "/etc/lsb-release" ]; then
#check if lsb-release present, and use it to override os-release, as it is generally more accurate
        . /etc/lsb-release
    else
        ID="unknown"
        VERSION_ID="unknown"
    fi
    export GG_PLATFORM_ID="$ID"
    export GG_PLATFORM_VERSION="$VERSION_ID"


#the following three should not be changed manually, make tools set them
    export GG_LIBRARY_PATH=/usr/lib/golf
    export GG_INCLUDE_PATH=/usr/include/golf
    export GG_VERSION=100.100

#do not execute again if already done
    export GG_SYSTEM_DONE=1
fi 


#
#
#
#From here on, only system requests are allowed, each exiting with 'exit'
#
#
#

if [ "$1" == "pgconf" ]; then
    ECODE="0"
    which pg_config 2>/dev/null 1>/dev/null || ECODE=$?
    if [ "$ECODE" == "0" ]; then
        echo "yes"
    else
        echo "no"
    fi
    exit 0
fi

if [ "$1" == "showid" ]; then
    echo $GG_PLATFORM_ID
    exit 0
fi