|
|
|
@ -4,9 +4,8 @@ ACTION=${1}
|
|
|
|
|
shift 1
|
|
|
|
|
|
|
|
|
|
get_image() {
|
|
|
|
|
local IMAGE_NAME=`uci get searxng.@searxng[0].image_name 2>/dev/null`
|
|
|
|
|
IMAGE_NAME=$(uci get searxng.@searxng[0].image_name 2>/dev/null)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
do_install_detail() {
|
|
|
|
|
local config=`uci get searxng.@searxng[0].config_path 2>/dev/null`
|
|
|
|
|
local port=`uci get searxng.@searxng[0].port 2>/dev/null`
|
|
|
|
@ -34,10 +33,11 @@ do_install_detail() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Create Docker Compose file with custom variables
|
|
|
|
|
mkdir /root/docker-compose/searxng-app
|
|
|
|
|
rm -R /opt/docker2/compose/searxng-app
|
|
|
|
|
mkdir /opt/docker2/compose/searxng-app
|
|
|
|
|
# Create Docker Compose file with custom variables
|
|
|
|
|
touch /root/docker-compose/searxng-app/docker-compose.yml
|
|
|
|
|
cat > /root/docker-compose/searxng-app/docker-compose.yml <<EOF
|
|
|
|
|
touch /opt/docker2/compose/searxng-app/docker-compose.yml
|
|
|
|
|
cat > /opt/docker2/compose/searxng-app/docker-compose.yml <<EOF
|
|
|
|
|
version: '3.7'
|
|
|
|
|
|
|
|
|
|
services:
|
|
|
|
@ -67,7 +67,8 @@ services:
|
|
|
|
|
plugsy.link: "http://${LAN_IP}:$port"
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
dockerdeploy searxng-app
|
|
|
|
|
# dockerdeploy searxng-app
|
|
|
|
|
docker-compose -f /opt/docker2/compose/searxng-app/docker-compose.yml up -d
|
|
|
|
|
|
|
|
|
|
# Add a new list option to the "shortcutmenu" configuration file
|
|
|
|
|
uci add shortcutmenu lists
|
|
|
|
@ -89,30 +90,36 @@ usage() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case ${ACTION} in
|
|
|
|
|
"install")
|
|
|
|
|
get_image
|
|
|
|
|
do_install_detail
|
|
|
|
|
;;
|
|
|
|
|
"upgrade")
|
|
|
|
|
"install"|"upgrade")
|
|
|
|
|
get_image
|
|
|
|
|
do_install_detail
|
|
|
|
|
;;
|
|
|
|
|
"rm")
|
|
|
|
|
docker ps -a --filter "$IMAGE_NAME" --format '{{.ID}}' | xargs -r docker stop && docker ps -a --filter "$IMAGE_NAME" --format '{{.ID}}' | xargs -r docker rm && docker rmi $IMAGE_NAME
|
|
|
|
|
|
|
|
|
|
docker rm -f searxng
|
|
|
|
|
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")
|
|
|
|
|
get_image
|
|
|
|
|
CONTAINER_IDS=$(docker ps -a --filter "ancestor=${IMAGE_NAME}" --format '{{.ID}}')
|
|
|
|
|
docker ${ACTION} ${ID}
|
|
|
|
|
for ID in $CONTAINER_IDS; do
|
|
|
|
|
docker ${ACTION} ${ID}
|
|
|
|
|
done
|
|
|
|
|
;;
|
|
|
|
|
"status")
|
|
|
|
|
get_image
|
|
|
|
|
CONTAINER_NAMES=$(docker ps -a --filter "ancestor=${IMAGE_NAME}" --format '{{.Names}}')
|
|
|
|
|
docker ps --all -f "name=${NAME}" --format '{{.Status}}'
|
|
|
|
|
docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Status}}'
|
|
|
|
|
;;
|
|
|
|
|
"port")
|
|
|
|
|
get_image
|
|
|
|
|
CONTAINER_NAMES=$(docker ps -a --filter "ancestor=${IMAGE_NAME}" --format '{{.Names}}')
|
|
|
|
|
docker ps --all -f "name=${NAME}" --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*' | sed 's/0.0.0.0://'
|
|
|
|
|
docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*' | sed 's/0.0.0.0://'
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
usage
|
|
|
|
|