Update 'root/usr/libexec/apps/mastodon/mastodon.sh'

main
ben 1 year ago
parent fa1a906475
commit 7117ce3b5a

@ -30,9 +30,23 @@ private_key=$(echo "$output" | grep VAPID_PRIVATE_KEY | awk -F= '{print $2}')
public_key=$(echo "$output" | grep VAPID_PUBLIC_KEY | awk -F= '{print $2}') public_key=$(echo "$output" | grep VAPID_PUBLIC_KEY | awk -F= '{print $2}')
if [ -z "$config" ]; then
echo "config path is empty!"
exit 1
fi
[ -z "$port" ] && port=""
[ -z "$IMAGE_NAME" ] && IMAGE_NAME=lscr.io/linuxserver/mastodon:latest
rm -R /opt/docker2/compose/mastodon
mkdir /opt/docker2/compose/mastodon
touch /opt/docker2/compose/mastodon/docker-compose.yml
cat > /opt/docker2/compose/mastodon/docker-compose.yml
# Create Docker Compose file with custom variables # Create Docker Compose file with custom variables
touch docker-compose.yml
cat > docker-compose.yml <<EOF cat > /opt/docker2/compose/mastodon/docker-compose.yml <<EOF
version: "2.1" version: "2.1"
services: services:
mastodon: mastodon:
@ -104,23 +118,9 @@ services:
restart: unless-stopped restart: unless-stopped
EOF EOF
docker-compose up -d docker-compose -f /opt/docker2/compose/mastodon/docker-compose.yml up -d
if [ -z "$config" ]; then
echo "config path is empty!"
exit 1
fi
[ -z "$port" ] && port=""
[ -z "$IMAGE_NAME" ] && IMAGE_NAME=lscr.io/linuxserver/mastodon:latest
# Create Docker Compose file with custom variables
docker-compose up -d
# Add a new list option to the "shortcutmenu" configuration file # Add a new list option to the "shortcutmenu" configuration file
uci add shortcutmenu lists uci add shortcutmenu lists
@ -131,6 +131,7 @@ docker-compose up -d
} }
usage() { usage() {
echo "usage: $0 sub-command" echo "usage: $0 sub-command"
echo "where sub-command is one of:" echo "where sub-command is one of:"
@ -142,25 +143,36 @@ usage() {
} }
case ${ACTION} in case ${ACTION} in
"install") "install"|"upgrade")
get_image
do_install_detail
;;
"upgrade")
do_install_detail do_install_detail
;; ;;
"rm") "rm")
docker rm -f mastodon get_image
CONTAINER_IDS=$(docker ps -a --filter "ancestor=${IMAGE_NAME}" --format '{{.ID}}')
echo "Stopping and removing containers..."
for ID in $CONTAINER_IDS; do
docker stop $ID
docker rm $ID
done
docker rmi -f $IMAGE_NAME
;; ;;
"start" | "stop" | "restart") "start"|"stop"|"restart")
docker ${ACTION} mastodon get_image
CONTAINER_IDS=$(docker ps -a --filter "ancestor=${IMAGE_NAME}" --format '{{.ID}}')
for ID in $CONTAINER_IDS; do
docker ${ACTION} ${ID}
done
;; ;;
"status") "status")
docker ps --all -f 'name=mastodon' --format '{{.State}}' get_image
CONTAINER_NAMES=$(docker ps -a --filter "ancestor=${IMAGE_NAME}" --format '{{.Names}}')
docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Status}}'
;; ;;
"port") "port")
docker ps --all -f 'name=mastodon' --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*' | sed 's/0.0.0.0://' get_image
CONTAINER_NAMES=$(docker ps -a --filter "ancestor=${IMAGE_NAME}" --format '{{.Names}}')
docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*' | sed 's/0.0.0.0://'
;; ;;
*) *)
usage usage

Loading…
Cancel
Save