Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/bash
set -e
while getopts p:d: parameter_Option
do case "${parameter_Option}"
in
p) PYTHON_VER=${OPTARG};;
d) DEVICE_TYPE=${OPTARG};;
*) echo "Usage: $0 -p PYTHON_VER -d DEVICE_TYPE";;
esac
done
 
PYTHON_VER=${PYTHON_VER:=3.8}
# Some Edge devices only have limited disk space, use this option to exclude some package
DEVICE_TYPE=${DEVICE_TYPE:=Normal}
 
# shellcheck disable=SC2034
DEBIAN_FRONTEND=noninteractive
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
 
apt-get update && apt-get install -y software-properties-common lsb-release
 
OS_VERSION=$(lsb_release -r -s)
 
PACKAGE_LIST=(
    "apt-transport-https"
    "apt-utils"
    "aria2"
    "autoconf"
    "automake"
    "autotools-dev"
    "build-essential"
    "bzip2"
    "ca-certificates"
    "curl"
    "gfortran"
    "git"
    "graphviz"
    "language-pack-en"
    "libcurl4"
    "libcurl4-openssl-dev"
    "libexpat1-dev"
    "libkrb5-3"
    "liblttng-ust-dev"
    "libpng-dev"
    "libssl-dev"
    "libtinfo-dev"
    "libtinfo5"
    "libtool"
    "libunwind8"
    "openjdk-17-jdk"
    "openssh-server"
    "pkg-config"
    "python3-dev"
    "python3-distutils"
    "python3-pip"
    "python3-pytest"
    "python3-setuptools"
    "python3-wheel"
    "rsync"
    "sudo"
    "unzip"
    "wget"
    "zip"
    "zlib1g"
    "zlib1g-dev"
)
if [ "$DEVICE_TYPE" = "Normal" ]; then
    PACKAGE_LIST+=("libedit-dev" "libxml2-dev" "python3-packaging")
fi
 
PACKAGE_LIST+=("libicu-dev")
 
apt-get install -y --no-install-recommends "${PACKAGE_LIST[@]}"
 
locale-gen en_US.UTF-8
update-locale LANG=en_US.UTF-8
 
if [ "$OS_VERSION" = "20.04" ]; then
  # The defaul version of python is 3.8
    major=$(echo "$PYTHON_VER" | cut -d. -f1)
    minor=$(echo "$PYTHON_VER" | cut -d. -f2)
    if [ "$major" -lt 3 ] || [ "$major" -eq 3 ] && [ "$minor" -lt 8 ]; then
      PYTHON_VER="3.8"
    fi
    if [ "$PYTHON_VER" != "3.8" ]; then
        add-apt-repository -y ppa:deadsnakes/ppa
        apt-get update
        apt-get install -y --no-install-recommends \
                python"${PYTHON_VER}" \
                python"${PYTHON_VER}-"dev
        update-alternatives --install /usr/bin/python3 python3 /usr/bin/python"${PYTHON_VER}" 1
        update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
        update-alternatives --set python3 /usr/bin/python"${PYTHON_VER}"
        #TODO: the old one(/usr/bin/pip3) should be uninstalled first. Because the one will be
        #put at /usr/local/. Then there will be two pips.
        /usr/bin/python"${PYTHON_VER}" -m pip install --upgrade --force-reinstall pip==19.0.3
    fi
elif [ "$OS_VERSION" = "22.04" ] ; then
  # The defaul version of python is 3.10
    major=$(echo "$PYTHON_VER" | cut -d. -f1)
    minor=$(echo "$PYTHON_VER" | cut -d. -f2)
    if [ "$major" -lt 3 ] || [ "$major" -eq 3 ] && [ "$minor" -lt 10 ]; then
      PYTHON_VER="3.10"
    fi
    if [ "$PYTHON_VER" != "3.10" ]; then
        add-apt-repository -y ppa:deadsnakes/ppa
        apt-get update
        apt-get install -y --no-install-recommends \
                python"${PYTHON_VER}" \
                python"${PYTHON_VER}"-dev
        update-alternatives --install /usr/bin/python3 python3 /usr/bin/python"${PYTHON_VER}" 1
        update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
        update-alternatives --set python3 /usr/bin/python"${PYTHON_VER}"
    fi
else
    exit 1
fi
 
rm -rf /var/lib/apt/lists/*