Added script source for software installs via config.json

This commit is contained in:
Kieron Wilkinson
2024-09-26 21:24:12 +01:00
parent 4ffd42fa74
commit 74dc515cab
3 changed files with 91 additions and 15 deletions
+65 -1
View File
@@ -4,6 +4,13 @@
"group-id": 121
},
"install": [
{
"category": "aws",
"source": "script",
"packages": [
"aws-cli"
]
},
{
"category": "development",
"source": "apt",
@@ -18,6 +25,49 @@
"software-properties-common"
]
},
{
"category": "container-tools",
"source": "script",
"packages": [
"container-tools"
]
},
{
"category": "debugging",
"source": "script",
"packages": [
"liblttng-ust"
]
},
{
"category": "docker-cli",
"source": "script",
"packages": [
"docker-cli"
]
},
{
"category": "docker",
"source": "script",
"packages": [
"docker"
]
},
{
"category": "git",
"source": "script",
"packages": [
"git",
"git-lfs"
]
},
{
"category": "github",
"source": "script",
"packages": [
"github-cli"
]
},
{
"category": "network-tools",
"source": "apt",
@@ -29,12 +79,19 @@
]
},
{
"category": "nodejs",
"category": "node",
"source": "apt",
"packages": [
"nodejs"
]
},
{
"category": "powershell",
"source": "script",
"packages": [
"powershell"
]
},
{
"category": "python",
"source": "apt",
@@ -44,6 +101,13 @@
"python3-setuptools",
"python3-venv"
]
},
{
"category": "yq",
"source": "script",
"packages": [
"yq"
]
}
]
}
+4
View File
@@ -16,3 +16,7 @@ function group_id() {
function apt_packages() {
jq -r '.install[] | select(.source == "apt") | .packages[]' "$(config_file)" | paste -sd ' ' -
}
function script_packages() {
jq -r '.install[] | select(.source == "script") | .packages[]' "$(config_file)"
}
+22 -14
View File
@@ -6,7 +6,7 @@ function install_git() {
|| apt-get install -t stable -y --no-install-recommends git )
}
function install_liblttng_ust() {
function install_liblttng-ust() {
if [[ $(apt-cache search -n liblttng-ust0 | awk '{print $1}') == "liblttng-ust0" ]]; then
apt-get install -y --no-install-recommends liblttng-ust0
fi
@@ -16,7 +16,7 @@ function install_liblttng_ust() {
fi
}
function install_awscli() {
function install_aws-cli() {
( curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" \
&& unzip -q awscliv2.zip -d /tmp/ \
&& /tmp/aws/install \
@@ -25,7 +25,7 @@ function install_awscli() {
|| pip3 install --no-cache-dir awscli
}
function install_gitlfs() {
function install_git-lfs() {
local DPKG_ARCH
DPKG_ARCH="$(dpkg --print-architecture)"
@@ -35,6 +35,10 @@ function install_gitlfs() {
rm -rf /tmp/lfs.tar.gz "/tmp/git-lfs-${GIT_LFS_VERSION}"
}
function install_docker-cli() {
apt-get install -y docker-ce-cli --no-install-recommends --allow-unauthenticated
}
function install_docker() {
apt-get install -y docker-ce docker-ce-cli docker-buildx-plugin containerd.io docker-compose-plugin --no-install-recommends --allow-unauthenticated
@@ -44,11 +48,11 @@ function install_docker() {
sed -i 's/ulimit -Hn/# ulimit -Hn/g' /etc/init.d/docker
}
function install_container_tools() {
function install_container-tools() {
( apt-get install -y --no-install-recommends podman buildah skopeo || : )
}
function install_githubcli() {
function install_github-cli() {
local DPKG_ARCH GH_CLI_VERSION GH_CLI_DOWNLOAD_URL
DPKG_ARCH="$(dpkg --print-architecture)"
@@ -104,13 +108,17 @@ function install_powershell() {
}
function install_tools() {
install_git
install_liblttng_ust
install_awscli
install_gitlfs
install_docker
install_container_tools
install_githubcli
install_yq
install_powershell
local function_name
# shellcheck source=/dev/null
source "$(dirname "${BASH_SOURCE[0]}")/config.sh"
script_packages | while read -r package; do
function_name="install_${package}"
if declare -f "${function_name}" > /dev/null; then
"${function_name}"
else
echo "No install script found for package: ${package}"
exit 1
fi
done
}