Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/test-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ jobs:
strategy:
fail-fast: false
matrix:
includes:
include:
- image: mcr.microsoft.com/devcontainers/base:ubuntu
options: '{ "version": "2.9.0-4.0.dev-1" }'
- image: debian:bookworm-slim
runs-on: ubuntu-latest
steps:
Expand Down
52 changes: 16 additions & 36 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,39 +1,19 @@
#!/bin/sh
set -eux
#!/bin/bash
set -ex
source lib.sh

BASEURL="https://storage.googleapis.com/dart-archive/channels"
DART_VER=$VERSION
export DEBIAN_FRONTEND="noninteractive"
apt update
apt install -y --no-install-recommends \
curl \
ca-certificates \
unzip \
xz-utils \
zip \
file
check_packages wget gpg apt-transport-https
wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/dart.gpg
echo 'deb [signed-by=/usr/share/keyrings/dart.gpg arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' >/etc/apt/sources.list.d/dart_stable.list

case "$(dpkg --print-architecture)" in
amd64)
DART_SHA256=cccd5300faa5a9abce12a5f77586e26350028cea82bb4ff8eeb55641b58a2e1d
SDK_ARCH="x64"
;;
armhf)
DART_SHA256=3a15d42cb1677ac5e50a23045cafe3bf5db2855a5287a3e9019b849fe8477897
SDK_ARCH="arm"
;;
arm64)
DART_SHA256=2c8eeaf0d3da60c4e14beec45ce3b39aca754f71b9fa3fb0c635ee28d6f44708
SDK_ARCH="arm64"
;;
esac
apt-get update
if [[ $VERSION == latest ]]; then
apt-get install dart
else
apt-get install dart=$VERSION
fi

SDK="dartsdk-linux-${SDK_ARCH}-release.zip"
URL="$BASEURL/stable/release/${DART_VER}/sdk/$SDK"
curl -fLO "$URL"
echo "$DART_SHA256 *$SDK" | sha256sum --check --status --strict -
unzip "$SDK"
mv dart-sdk "$DART_ROOT"
rm "$SDK"
chmod 755 "$DART_ROOT"
chmod 755 "$DART_ROOT/bin"
updaterc 'export PATH="$PATH:/usr/lib/dart/bin"'

# Clean up
rm -rf /var/lib/apt/lists/*
29 changes: 29 additions & 0 deletions lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

apt_get_update()
{
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
}

# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}

updaterc() {
# if [ "${UPDATE_RC}" = "true" ]; then
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then
echo -e "$1" >> /etc/bash.bashrc
fi
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then
echo -e "$1" >> /etc/zsh/zshrc
fi
# fi
}