Skip to content

Commit

Permalink
Software title: Stirling PDF (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik authored Dec 2, 2024
1 parent 4d4c480 commit 3f9fc8c
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 0 deletions.
Binary file added tools/include/images/MED010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions tools/include/markdown/MED010-footer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
=== "Access to the web interface"

The web interface is accessible via port **8077**:

- URL: `https://<your.IP>:8077`

=== "Directories"

- Install directory: `/armbian/stirling`

=== "View logs"

```sh
docker logs -f stirling-pdf
```
1 change: 1 addition & 0 deletions tools/include/markdown/MED010-header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Stirling-PDF is a robust, locally hosted web-based PDF manipulation tool using Docker. It enables you to carry out various operations on PDF files, including splitting, merging, converting, reorganizing, adding images, rotating, compressing, and more. This locally hosted web application has evolved to encompass a comprehensive set of features, addressing all your PDF requirements.
31 changes: 31 additions & 0 deletions tools/json/config.software.json
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,38 @@
"status": "Stable",
"author": "@schwar3kat",
"condition": "check_if_installed emby-server"
},
{
"id": "MED010",
"description": "Stirling-PDF Install",
"command": [
"module_stirling install"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "! module_stirling status"
},
{
"id": "MED011",
"description": "Stirling-PDF Remove",
"command": [
"module_stirling remove"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "module_stirling status"
},
{
"id": "MED012",
"description": "Stirling-PDF Purge data folder",
"command": [
"module_stirling purge"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "! module_stirling status && [[ -d \"${SOFTWARE_FOLDER}/stirling\" ]]"
}

]
},
{
Expand Down
8 changes: 8 additions & 0 deletions tools/modules/runtime/config.runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ fi

#
# Sub sub menu updates
#cockpit_port="$(systemctl cat cockpit.socket | grep ListenStream | awk -F= '{print $2}' | awk '{print $1}')"
#update_sub_submenu_data "Software" "Management" "M03" "https://localhost:$cockpit_port"
#emby_media_port="$(lsof -i -P -n | grep TCP | grep LISTEN | grep 'emby' | awk -F: '{print $2}' | awk '{print $1}')"
#update_sub_submenu_data "Software" "Media" "SW24" "https://localhost:$emby_media_port"
#plex_media_port="$(lsof -i -P -n | grep TCP | grep LISTEN | grep 'plex' | awk -F: '{print $2}' | awk '{print $1}' | head -n 1)"
#update_sub_submenu_data "Software" "Media" "SW22" "https://localhost:$plex_media_port"

update_sub_submenu_data "Software" "Media" "MED006" "http://$LOCALIPADD:${module_options["module_stirling,port"]}"
update_sub_submenu_data "Software" "Containers" "CON006" "http://$LOCALIPADD:${module_options["module_portainer,port"]}"
update_sub_submenu_data "Software" "HomeAutomation" "HA004" "http://$LOCALIPADD:${module_options["module_haos,port"]}"
update_sub_submenu_data "Software" "Monitoring" "MON004" "http://$LOCALIPADD:${module_options["module_netdata,port"]}"
Expand Down
85 changes: 85 additions & 0 deletions tools/modules/software/install_stirling.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
module_options+=(
["module_stirling,author"]="@Frooodle"
["module_stirling,maintainer"]="@armbian @igorpecovnik"
["module_stirling,testers"]="@igorpecovnik"
["module_stirling,feature"]="module_stirling"
["module_stirling,desc"]="Install stirling container"
["module_stirling,example"]="install remove purge status help"
["module_stirling,port"]="8077"
["module_stirling,status"]="Active"
["module_stirling,arch"]=""
)
#
# Module stirling-PDF
#
function module_stirling () {
local title="stirling"
local condition=$(which "$title" 2>/dev/null)

if check_if_installed docker-ce; then
local container=$(docker container ls -a | mawk '/stirling-pdf?( |$)/{print $1}')
local image=$(docker image ls -a | mawk '/stirling-pdf?( |$)/{print $3}')
fi

local commands
IFS=' ' read -r -a commands <<< "${module_options["module_stirling,example"]}"

STIRLING_BASE="${SOFTWARE_FOLDER}/stirling"

case "$1" in
"${commands[0]}")
check_if_installed docker-ce || install_docker
[[ -d "$STIRLING_BASE" ]] || mkdir -p "$STIRLING_BASE" || { echo "Couldn't create storage directory: $STIRLING_BASE"; exit 1; }
docker run -d \
-p 8077:8080 \
-v "${STIRLING_BASE}/trainingData:/usr/share/tessdata" \
-v "${STIRLING_BASE}/extraConfigs:/configs" \
-v "${STIRLING_BASE}/logs:/logs" \
-v "${STIRLING_BASE}/customFiles:/customFiles" \
-e DOCKER_ENABLE_SECURITY=false \
-e INSTALL_BOOK_AND_ADVANCED_HTML_OPS=false \
-e LANGS=en_GB \
--name stirling-pdf \
stirlingtools/stirling-pdf:latest
for i in $(seq 1 20); do
if docker inspect -f '{{ index .Config.Labels "build_version" }}' stirling-pdf >/dev/null 2>&1 ; then
break
else
sleep 3
fi
if [ $i -eq 20 ] ; then
echo -e "\nTimed out waiting for ${title} to start, consult your container logs for more info (\`docker logs stirling-pdf\`)"
exit 1
fi
done
;;
"${commands[1]}")
[[ "${container}" ]] && docker container rm -f "$container" >/dev/null
[[ "${image}" ]] && docker image rm "$image" >/dev/null
;;
"${commands[2]}")
[[ -n "${STIRLING_BASE}" && "${STIRLING_BASE}" != "/" ]] && rm -rf "${STIRLING_BASE}"
;;
"${commands[3]}")
if [[ "${container}" && "${image}" ]]; then
return 0
else
return 1
fi
;;
"${commands[4]}")
echo -e "\nUsage: ${module_options["module_stirling,feature"]} <command>"
echo -e "Commands: ${module_options["module_stirling,example"]}"
echo "Available commands:"
echo -e "\tinstall\t- Install $title."
echo -e "\tremove\t- Remove $title."
echo -e "\tpurge\t- Purge $title data folder."
echo -e "\tstatus\t- Installation status $title."

echo
;;
*)
${module_options["module_stirling,feature"]} ${commands[4]}
;;
esac
}

0 comments on commit 3f9fc8c

Please sign in to comment.