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

main
ben 1 year ago
parent 5c69c6402d
commit ff202000aa

@ -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,8 +67,9 @@ 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
uci set shortcutmenu.@lists[-1].webname="$IMAGE_NAME"
@ -89,33 +90,39 @@ 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
exit 1
;;
esac
esac
Loading…
Cancel
Save