Apply shellcheck
This commit is contained in:
parent
ce5f1f40ac
commit
3436125897
2 changed files with 41 additions and 25 deletions
|
@ -14,37 +14,47 @@ SERIAL="1benoitjpnet"
|
|||
CNAME="$UPSTREAM_NAME-$UPSTREAM_VER_DASH-$SERIAL-$DIST-$VER"
|
||||
ALIAS="$UPSTREAM_NAME-$UPSTREAM_VER-$SERIAL"
|
||||
|
||||
cd $WORKSPACE
|
||||
incus launch images:$IMAGE $CNAME --quiet
|
||||
cd "$WORKSPACE"
|
||||
incus launch images:$IMAGE "$CNAME" --quiet
|
||||
|
||||
# Wait for network
|
||||
timeout 30 bash -c 'until incus exec $CNAME -- ping -c1 google.com &>/dev/null; do sleep 1; done'
|
||||
timeout 30 bash -c "until incus exec $CNAME -- ping -c1 google.com &>/dev/null; do sleep 1; done"
|
||||
|
||||
# Mastodon
|
||||
incus exec $CNAME -- bash -c '
|
||||
apt update && \
|
||||
apt upgrade -y && \
|
||||
apt install -y --no-install-recommends curl wget gnupg apt-transport-https lsb-release ca-certificates
|
||||
incus exec "$CNAME" -- bash -c '
|
||||
apt update && \
|
||||
apt upgrade -y && \
|
||||
apt install -y --no-install-recommends \
|
||||
curl \
|
||||
wget \
|
||||
gnupg \
|
||||
apt-transport-https \
|
||||
lsb-release \
|
||||
ca-certificates
|
||||
'
|
||||
incus file push $WORKSPACE/{setup.sh,setup_mastodon.sh} $CNAME/tmp/
|
||||
incus exec $CNAME -- bash /tmp/setup.sh
|
||||
incus exec $CNAME --user 1001 --env HOME=/home/mastodon -- bash /tmp/setup_mastodon.sh
|
||||
incus file push $WORKSPACE/postgresql.conf $CNAME/etc/postgresql/17/main/postgresql.conf
|
||||
incus file push "$WORKSPACE"/{setup.sh,setup_mastodon.sh} "$CNAME"/tmp/
|
||||
incus exec "$CNAME" -- bash /tmp/setup.sh
|
||||
incus exec "$CNAME" \
|
||||
--user 1001 \
|
||||
--env HOME=/home/mastodon \
|
||||
--force-noninteractive \
|
||||
-- bash /tmp/setup_mastodon.sh
|
||||
incus file push "$WORKSPACE"/postgresql.conf "$CNAME"/etc/postgresql/17/main/postgresql.conf
|
||||
|
||||
# Clean
|
||||
incus exec $CNAME -- \
|
||||
incus exec "$CNAME" -- \
|
||||
rm -rf \
|
||||
/etc/machine-id \
|
||||
/var/cache/apt \
|
||||
/var/log/journal
|
||||
/etc/machine-id \
|
||||
/var/cache/apt \
|
||||
/var/log/journal
|
||||
|
||||
# Publish
|
||||
incus stop $CNAME
|
||||
incus config metadata show $CNAME > $ARCHIVE/metadata.yaml
|
||||
incus stop "$CNAME"
|
||||
incus config metadata show "$CNAME" > "$ARCHIVE"/metadata.yaml
|
||||
# Get the current Unix timestamp
|
||||
current_timestamp=$(date +%s)
|
||||
# Calculate expiry date as current timestamp + 1 week (604800 seconds)
|
||||
expiry_date=$(($current_timestamp + 604800))
|
||||
expiry_date=$((current_timestamp + 604800))
|
||||
# Update metadata values
|
||||
sed -i \
|
||||
-e "s/creation_date: .*/creation_date: $current_timestamp/" \
|
||||
|
@ -52,8 +62,11 @@ sed -i \
|
|||
-e "s#description: .*#description: $UPSTREAM_NAME v$UPSTREAM_VER on $IMAGE release $SERIAL#" \
|
||||
-e "s/name: .*/name: $CNAME/" \
|
||||
-e "s/serial: .*/serial: $SERIAL/" \
|
||||
$ARCHIVE/metadata.yaml
|
||||
"$ARCHIVE"/metadata.yaml
|
||||
|
||||
incus config metadata edit $CNAME < $ARCHIVE/metadata.yaml
|
||||
incus publish $CNAME --alias $ALIAS --public --quiet
|
||||
incus rm $CNAME
|
||||
incus config metadata edit "$CNAME" < "$ARCHIVE"/metadata.yaml
|
||||
incus publish "$CNAME" \
|
||||
--alias $ALIAS \
|
||||
--public \
|
||||
--quiet
|
||||
incus rm "$CNAME"
|
||||
|
|
|
@ -3,16 +3,19 @@ set -euox pipefail
|
|||
|
||||
cd /home/mastodon
|
||||
git clone https://github.com/mastodon/mastodon.git live && cd live
|
||||
git checkout $(git tag -l | grep '^v[0-9.]*$' | sort -V | tail -n 1)
|
||||
git checkout "$(git tag -l | grep '^v[0-9.]*$' | sort -V | tail -n 1)"
|
||||
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
|
||||
{
|
||||
# shellcheck disable=SC2016
|
||||
echo 'export PATH="$HOME/.rbenv/bin:$PATH"'
|
||||
# shellcheck disable=SC2016
|
||||
echo 'eval "$(rbenv init -)"'
|
||||
} | tee -a ~/.bashrc ~/.profile
|
||||
# shellcheck disable=SC1090
|
||||
source ~/.profile
|
||||
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
|
||||
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install
|
||||
bundle config deployment 'true'
|
||||
bundle config without 'development test'
|
||||
bundle install -j$(getconf _NPROCESSORS_ONLN)
|
||||
yarn install --yes
|
||||
bundle install -j"$(getconf _NPROCESSORS_ONLN)"
|
||||
yarn install
|
||||
|
|
Loading…
Add table
Reference in a new issue