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"
|
CNAME="$UPSTREAM_NAME-$UPSTREAM_VER_DASH-$SERIAL-$DIST-$VER"
|
||||||
ALIAS="$UPSTREAM_NAME-$UPSTREAM_VER-$SERIAL"
|
ALIAS="$UPSTREAM_NAME-$UPSTREAM_VER-$SERIAL"
|
||||||
|
|
||||||
cd $WORKSPACE
|
cd "$WORKSPACE"
|
||||||
incus launch images:$IMAGE $CNAME --quiet
|
incus launch images:$IMAGE "$CNAME" --quiet
|
||||||
|
|
||||||
# Wait for network
|
# 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
|
# Mastodon
|
||||||
incus exec $CNAME -- bash -c '
|
incus exec "$CNAME" -- bash -c '
|
||||||
apt update && \
|
apt update && \
|
||||||
apt upgrade -y && \
|
apt upgrade -y && \
|
||||||
apt install -y --no-install-recommends curl wget gnupg apt-transport-https lsb-release ca-certificates
|
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 file push "$WORKSPACE"/{setup.sh,setup_mastodon.sh} "$CNAME"/tmp/
|
||||||
incus exec $CNAME -- bash /tmp/setup.sh
|
incus exec "$CNAME" -- bash /tmp/setup.sh
|
||||||
incus exec $CNAME --user 1001 --env HOME=/home/mastodon -- bash /tmp/setup_mastodon.sh
|
incus exec "$CNAME" \
|
||||||
incus file push $WORKSPACE/postgresql.conf $CNAME/etc/postgresql/17/main/postgresql.conf
|
--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
|
# Clean
|
||||||
incus exec $CNAME -- \
|
incus exec "$CNAME" -- \
|
||||||
rm -rf \
|
rm -rf \
|
||||||
/etc/machine-id \
|
/etc/machine-id \
|
||||||
/var/cache/apt \
|
/var/cache/apt \
|
||||||
/var/log/journal
|
/var/log/journal
|
||||||
|
|
||||||
# Publish
|
# Publish
|
||||||
incus stop $CNAME
|
incus stop "$CNAME"
|
||||||
incus config metadata show $CNAME > $ARCHIVE/metadata.yaml
|
incus config metadata show "$CNAME" > "$ARCHIVE"/metadata.yaml
|
||||||
# Get the current Unix timestamp
|
# Get the current Unix timestamp
|
||||||
current_timestamp=$(date +%s)
|
current_timestamp=$(date +%s)
|
||||||
# Calculate expiry date as current timestamp + 1 week (604800 seconds)
|
# Calculate expiry date as current timestamp + 1 week (604800 seconds)
|
||||||
expiry_date=$(($current_timestamp + 604800))
|
expiry_date=$((current_timestamp + 604800))
|
||||||
# Update metadata values
|
# Update metadata values
|
||||||
sed -i \
|
sed -i \
|
||||||
-e "s/creation_date: .*/creation_date: $current_timestamp/" \
|
-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#description: .*#description: $UPSTREAM_NAME v$UPSTREAM_VER on $IMAGE release $SERIAL#" \
|
||||||
-e "s/name: .*/name: $CNAME/" \
|
-e "s/name: .*/name: $CNAME/" \
|
||||||
-e "s/serial: .*/serial: $SERIAL/" \
|
-e "s/serial: .*/serial: $SERIAL/" \
|
||||||
$ARCHIVE/metadata.yaml
|
"$ARCHIVE"/metadata.yaml
|
||||||
|
|
||||||
incus config metadata edit $CNAME < $ARCHIVE/metadata.yaml
|
incus config metadata edit "$CNAME" < "$ARCHIVE"/metadata.yaml
|
||||||
incus publish $CNAME --alias $ALIAS --public --quiet
|
incus publish "$CNAME" \
|
||||||
incus rm $CNAME
|
--alias $ALIAS \
|
||||||
|
--public \
|
||||||
|
--quiet
|
||||||
|
incus rm "$CNAME"
|
||||||
|
|
|
@ -3,16 +3,19 @@ set -euox pipefail
|
||||||
|
|
||||||
cd /home/mastodon
|
cd /home/mastodon
|
||||||
git clone https://github.com/mastodon/mastodon.git live && cd live
|
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
|
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
|
||||||
{
|
{
|
||||||
|
# shellcheck disable=SC2016
|
||||||
echo 'export PATH="$HOME/.rbenv/bin:$PATH"'
|
echo 'export PATH="$HOME/.rbenv/bin:$PATH"'
|
||||||
|
# shellcheck disable=SC2016
|
||||||
echo 'eval "$(rbenv init -)"'
|
echo 'eval "$(rbenv init -)"'
|
||||||
} | tee -a ~/.bashrc ~/.profile
|
} | tee -a ~/.bashrc ~/.profile
|
||||||
|
# shellcheck disable=SC1090
|
||||||
source ~/.profile
|
source ~/.profile
|
||||||
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
|
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
|
||||||
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install
|
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install
|
||||||
bundle config deployment 'true'
|
bundle config deployment 'true'
|
||||||
bundle config without 'development test'
|
bundle config without 'development test'
|
||||||
bundle install -j$(getconf _NPROCESSORS_ONLN)
|
bundle install -j"$(getconf _NPROCESSORS_ONLN)"
|
||||||
yarn install --yes
|
yarn install
|
||||||
|
|
Loading…
Add table
Reference in a new issue