From 3e5274a951a61dc81a72a269832ac90609a15c56 Mon Sep 17 00:00:00 2001 From: Fichtl <33128399+xFichtl1@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:28:50 +0100 Subject: [PATCH 1/9] Update config template in blocky-install.sh (#1059) * Update config template in blocky-install.sh * Removed most example configuration of the template in blocky-install.sh --- install/blocky-install.sh | 243 ++++---------------------------------- 1 file changed, 24 insertions(+), 219 deletions(-) diff --git a/install/blocky-install.sh b/install/blocky-install.sh index 7f075e3c..69374672 100644 --- a/install/blocky-install.sh +++ b/install/blocky-install.sh @@ -28,241 +28,46 @@ RELEASE=$(curl -s https://api.github.com/repos/0xERR0R/blocky/releases/latest | wget -qO- https://github.com/0xERR0R/blocky/releases/download/v${RELEASE}/blocky_v${RELEASE}_Linux_x86_64.tar.gz | tar -xzf - -C /opt/blocky/ cat </opt/blocky/config.yml -upstream: - # these external DNS resolvers will be used. Blocky picks 2 random resolvers from the list for each query - # format for resolver: [net:]host:[port][/path]. net could be empty (default, shortcut for tcp+udp), tcp+udp, tcp, udp, tcp-tls or https (DoH). If port is empty, default port will be used (53 for udp and tcp, 853 for tcp-tls, 443 for https (Doh)) - # this configuration is mandatory, please define at least one external DNS resolver - default: - # example for tcp+udp IPv4 server (https://digitalcourage.de/) - #- 5.9.164.112 - # Cloudflare - - 1.1.1.1 - # example for DNS-over-TLS server (DoT) - #- tcp-tls:fdns1.dismail.de:853 - # example for DNS-over-HTTPS (DoH) - #- https://dns.digitale-gesellschaft.ch/dns-query - # optional: use client name (with wildcard support: * - sequence of any characters, [0-9] - range) - # or single ip address / client subnet as CIDR notation - #laptop*: - #- 123.123.123.123 +# configuration documentation: https://0xerr0r.github.io/blocky/latest/configuration/ -# optional: timeout to query the upstream resolver. Default: 2s -#upstreamTimeout: 2s +upstreams: + groups: + # these external DNS resolvers will be used. Blocky picks 2 random resolvers from the list for each query + # format for resolver: [net:]host:[port][/path]. net could be empty (default, shortcut for tcp+udp), tcp+udp, tcp, udp, tcp-tls or https (DoH). If port is empty, default port will be used (53 for udp and tcp, 853 for tcp-tls, 443 for https (Doh)) + # this configuration is mandatory, please define at least one external DNS resolver + default: + # Cloudflare + - 1.1.1.1 + # Quad9 DNS-over-TLS server (DoT) + - tcp-tls:dns.quad9.net -# optional: If true, blocky will fail to start unless at least one upstream server per group is reachable. Default: false -#startVerifyUpstream: true - -# optional: Determines how blocky will create outgoing connections. This impacts both upstreams, and lists. -# accepted: dual, v4, v6 -# default: dual -#connectIPVersion: dual - -# optional: custom IP address(es) for domain name (with all sub-domains). Multiple addresses must be separated by a comma -# example: query "printer.lan" or "my.printer.lan" will return 192.168.178.3 -#customDNS: - #customTTL: 1h - # optional: if true (default), return empty result for unmapped query types (for example TXT, MX or AAAA if only IPv4 address is defined). - # if false, queries with unmapped types will be forwarded to the upstream resolver - #filterUnmappedTypes: true - # optional: replace domain in the query with other domain before resolver lookup in the mapping - #rewrite: - #example.com: printer.lan - #mapping: - #printer.lan: 192.168.178.3,2001:0db8:85a3:08d3:1319:8a2e:0370:7344 - -# optional: definition, which DNS resolver(s) should be used for queries to the domain (with all sub-domains). Multiple resolvers must be separated by a comma -# Example: Query client.fritz.box will ask DNS server 192.168.178.1. This is necessary for local network, to resolve clients by host name -#conditional: - # optional: if false (default), return empty result if after rewrite, the mapped resolver returned an empty answer. If true, the original query will be sent to the upstream resolver - # Example: The query "blog.example.com" will be rewritten to "blog.fritz.box" and also redirected to the resolver at 192.168.178.1. If not found and if was set to , the original query "blog.example.com" will be sent upstream. - # Usage: One usecase when having split DNS for internal and external (internet facing) users, but not all subdomains are listed in the internal domain. - #fallbackUpstream: false - # optional: replace domain in the query with other domain before resolver lookup in the mapping - #rewrite: - #example.com: fritz.box - #mapping: - #fritz.box: 192.168.178.1 - #lan.net: 192.168.178.1,192.168.178.2 - -# optional: use black and white lists to block queries (for example ads, trackers, adult pages etc.) +# optional: use allow/denylists to block queries (for example ads, trackers, adult pages etc.) blocking: - # definition of blacklist groups. Can be external link (http/https) or local file - blackLists: + # definition of denylist groups. Can be external link (http/https) or local file + denylists: ads: - - https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts - - http://sysctl.org/cameleon/hosts - - https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt - - | - # inline definition with YAML literal block scalar style - # hosts format - someadsdomain.com - special: - - https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews/hosts - # definition of whitelist groups. Attention: if the same group has black and whitelists, whitelists will be used to disable particular blacklist entries. If a group has only whitelist entries -> this means only domains from this list are allowed, all other domains will be blocked - whiteLists: - ads: - - whitelist.txt - - | - # inline definition with YAML literal block scalar style - # hosts format - whitelistdomain.com - # this is a regex - /^banners?[_.-]/ # definition: which groups should be applied for which client clientGroupsBlock: # default will be used, if no special definition for a client name exists default: - ads - - special - # use client name (with wildcard support: * - sequence of any characters, [0-9] - range) - # or single ip address / client subnet as CIDR notation - #laptop*: - #- ads - #192.168.178.1/24: - #- special - # which response will be sent, if query is blocked: - # zeroIp: 0.0.0.0 will be returned (default) - # nxDomain: return NXDOMAIN as return code - # comma separated list of destination IP addresses (for example: 192.100.100.15, 2001:0db8:85a3:08d3:1319:8a2e:0370:7344). Should contain ipv4 and ipv6 to cover all query types. Useful with running web server on this address to display the "blocked" page. - blockType: zeroIp - # optional: TTL for answers to blocked domains - # default: 6h - blockTTL: 1m - # optional: automatically list refresh period (in duration format). Default: 4h. - # Negative value -> deactivate automatically refresh. - # 0 value -> use default - refreshPeriod: 4h - # optional: timeout for list download (each url). Default: 60s. Use large values for big lists or slow internet connections - downloadTimeout: 4m - # optional: Download attempt timeout. Default: 60s - downloadAttempts: 5 - # optional: Time between the download attempts. Default: 1s - downloadCooldown: 10s - # optional: if failOnError, application startup will fail if at least one list can't be downloaded / opened. Default: blocking - #startStrategy: failOnError - -# optional: configuration for caching of DNS responses -caching: - # duration how long a response must be cached (min value). - # If <=0, use response's TTL, if >0 use this value, if TTL is smaller - # Default: 0 - minTime: 5m - # duration how long a response must be cached (max value). - # If <0, do not cache responses - # If 0, use TTL - # If > 0, use this value, if TTL is greater - # Default: 0 - maxTime: 30m - # Max number of cache entries (responses) to be kept in cache (soft limit). Useful on systems with limited amount of RAM. - # Default (0): unlimited - maxItemsCount: 0 - # if true, will preload DNS results for often used queries (default: names queried more than 5 times in a 2-hour time window) - # this improves the response time for often used queries, but significantly increases external traffic - # default: false - prefetching: true - # prefetch track time window (in duration format) - # default: 120 - prefetchExpires: 2h - # name queries threshold for prefetch - # default: 5 - prefetchThreshold: 5 - # Max number of domains to be kept in cache for prefetching (soft limit). Useful on systems with limited amount of RAM. - # Default (0): unlimited - #prefetchMaxItemsCount: 0 - -# optional: configuration of client name resolution -clientLookup: - # optional: this DNS resolver will be used to perform reverse DNS lookup (typically local router) - #upstream: 192.168.178.1 - # optional: some routers return multiple names for client (host name and user defined name). Define which single name should be used. - # Example: take second name if present, if not take first name - #singleNameOrder: - #- 2 - #- 1 - # optional: custom mapping of client name to IP addresses. Useful if reverse DNS does not work properly or just to have custom client names. - #clients: - #laptop: - #- 192.168.178.29 -# optional: configuration for prometheus metrics endpoint -prometheus: - # enabled if true - #enable: true - # url path, optional (default '/metrics') - #path: /metrics # optional: write query information (question, answer, client, duration etc.) to daily csv file queryLog: # optional one of: mysql, postgresql, csv, csv-client. If empty, log to console - #type: mysql - # directory (should be mounted as volume in docker) for csv, db connection string for mysql/postgresql - #target: db_user:db_password@tcp(db_host_or_ip:3306)/db_name?charset=utf8mb4&parseTime=True&loc=Local - #postgresql target: postgres://user:password@db_host_or_ip:5432/db_name - # if > 0, deletes log files which are older than ... days - #logRetentionDays: 7 - # optional: Max attempts to create specific query log writer, default: 3 - #creationAttempts: 1 - # optional: Time between the creation attempts, default: 2s - #creationCooldown: 2s + type: -# optional: Blocky can synchronize its cache and blocking state between multiple instances through redis. -redis: - # Server address and port - #address: redis:6379 - # Password if necessary - #password: passwd - # Database, default: 0 - #database: 2 - # Connection is required for blocky to start. Default: false - #required: true - # Max connection attempts, default: 3 - #connectionAttempts: 10 - # Time between the connection attempts, default: 1s - #connectionCooldown: 3s +# optional: use these DNS servers to resolve denylist urls and upstream DNS servers. It is useful if no system DNS resolver is configured, and/or to encrypt the bootstrap queries. +bootstrapDns: + - upstream: tcp-tls:one.one.one.one + ips: + - 1.1.1.1 -# optional: DNS listener port(s) and bind ip address(es), default 53 (UDP and TCP). Example: 53, :53, "127.0.0.1:5353,[::1]:5353" -port: 553 -# optional: Port(s) and bind ip address(es) for DoT (DNS-over-TLS) listener. Example: 853, 127.0.0.1:853 -#tlsPort: 853 -# optional: HTTPS listener port(s) and bind ip address(es), default empty = no http listener. If > 0, will be used for prometheus metrics, pprof, REST API, DoH... Example: 443, :443, 127.0.0.1:443 -#httpPort: 4000 -#httpsPort: 443 -# optional: Mininal TLS version that the DoH and DoT server will use -#minTlsServeVersion: 1.3 -# if https port > 0: path to cert and key file for SSL encryption. if not set, self-signed certificate will be generated -#certFile: server.crt -#keyFile: server.key -# optional: use this DNS server to resolve blacklist urls and upstream DNS servers. Useful if no DNS resolver is configured and blocky needs to resolve a host name. Format net:IP:port, net must be udp or tcp -#bootstrapDns: tcp+udp:1.1.1.1 - -filtering: -# optional: drop all queries with following query types. Default: empty - #queryTypes: - #- AAAA - -# optional: if path defined, use this file for query resolution (A, AAAA and rDNS). Default: empty -hostsFile: - # optional: Path to hosts file (e.g. /etc/hosts on Linux) - #filePath: /etc/hosts - # optional: TTL, default: 1h - #hostsTTL: 60m - # optional: Time between hosts file refresh, default: 1h - #refreshPeriod: 30m - # optional: Whether loopback hosts addresses (127.0.0.0/8 and ::1) should be filtered or not, default: false - #filterLoopback: true -# optional: Log level (one from debug, info, warn, error). Default: info -#logLevel: info -# optional: Log format (text or json). Default: text -#logFormat: text -# optional: log timestamps. Default: true -#logTimestamp: true -# optional: obfuscate log output (replace all alphanumeric characters with *) for user sensitive data like request domains or responses to increase privacy. Default: false -#logPrivacy: false - -# optional: add EDE error codes to dns response -#ede: - # enabled if true, Default: false - #enable: true +# optional: logging configuration +log: + # optional: Log level (one from trace, debug, info, warn, error). Default: info + level: info EOF msg_ok "Installed Blocky" From 618445ec087c8437c2d769698ed06586befc0922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Thu, 2 Jan 2025 20:29:27 +0100 Subject: [PATCH 2/9] New Script: 5etools (#1157) * Testing 5etools. * Adding httpd-foreground step for updates. * Debug. * Debug. * Debug. * Debug. * Debug. * Debug. * Debug. * Debug. * Fix version names. * Added 5etools json. * Introduced images and increased storage. * Fixing version zip names. * Increased storage. * Introduced image versions. * Clean-up. * Renamed step. * Increased git post buffer. * Fixing echo command. * Fix tags. * Finetune storage size. * cleanup and restore. * Update ct/5etools.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Update ct/5etools.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Update ct/5etools.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Update install/5etools-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Update install/5etools-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Update install/5etools-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Update install/5etools-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Update install/5etools-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Update install/5etools-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Update install/5etools-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Moving stuff around. * Cleanup and finetune. * Update 5etools-install.sh * Switched to release crawling. * Update 5etools-install.sh * Update 5etools-install.sh * Update 5etools.sh * Update 5etools-install.sh * Update 5etools-install.sh * Update 5etools.sh * Update 5etools.sh * Update 5etools.json * Update 5etools-install.sh * Update 5etools.sh * Update 5etools-install.sh * Update 5etools.sh * Update 5etools-install.sh * Update 5etools.sh * Update 5etools.sh * Update 5etools-install.sh * Update 5etools.sh * Update 5etools.json * Update 5etools.sh * Update 5etools.sh Fixed update script * Update 5etools.json --------- Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com> --- ct/5etools.sh | 109 +++++++++++++++++++++++++++++++++++++ install/5etools-install.sh | 67 +++++++++++++++++++++++ json/5etools.json | 34 ++++++++++++ 3 files changed, 210 insertions(+) create mode 100644 ct/5etools.sh create mode 100644 install/5etools-install.sh create mode 100644 json/5etools.json diff --git a/ct/5etools.sh b/ct/5etools.sh new file mode 100644 index 00000000..b0a40cf8 --- /dev/null +++ b/ct/5etools.sh @@ -0,0 +1,109 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: TheRealVira +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://5e.tools/ + +# App Default Values +APP="5etools" +var_tags="wiki" +var_cpu="1" +var_ram="512" +var_disk="13" +var_os="debian" +var_version="12" +var_unprivileged="1" + +# App Output & Base Settings +header_info "$APP" +base_settings + +# Core +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + # Check if installation is present | -f for file, -d for folder + if [[ ! -d "/opt/${APP}" ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + RELEASE=$(curl -s https://api.github.com/repos/5etools-mirror-3/5etools-src/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f "/opt/${APP}_version.txt" ]]; then + # Crawling the new version and checking whether an update is required + msg_info "Updating System" + apt-get update &>/dev/null + apt-get -y upgrade &>/dev/null + msg_ok "Updated System" + + # Execute Update + msg_info "Updating base 5etools" + wget -q "https://github.com/5etools-mirror-3/5etools-src/archive/refs/tags/${RELEASE}.zip" + unzip -q "${RELEASE}.zip" + mv "/opt/${APP}/img" "/opt/img-backup" + rm -rf "/opt/${APP}" + mv "${APP}-src-${RELEASE:1}" "/opt/${APP}" + mv "/opt/img-backup" "/opt/${APP}/img" + echo "${RELEASE}" >"/opt/${APP}_version.txt" + msg_ok "Updated base 5etools" + + chown -R www-data: "/opt/${APP}" + chmod -R 755 "/opt/${APP}" + + # Cleaning up + msg_info "Cleaning Up" + rm "${RELEASE}.zip" + $STD apt-get -y autoremove + $STD apt-get -y autoclean + msg_ok "Cleanup Completed" + else + msg_ok "No update required. Base ${APP} is already at ${RELEASE}" + fi + + IMG_RELEASE=$(curl -s https://api.github.com/repos/5etools-mirror-2/5etools-img/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ "${IMG_RELEASE}" != "$(cat /opt/${APP}_IMG_version.txt)" ]] || [[ ! -f "/opt/${APP}_IMG_version.txt" ]]; then + # Crawling the new version and checking whether an update is required + msg_info "Updating System" + apt-get update &>/dev/null + apt-get -y upgrade &>/dev/null + msg_ok "Updated System" + + # Execute Update + msg_info "Updating 5etools images" + curl -sSL "https://github.com/5etools-mirror-2/5etools-img/archive/refs/tags/${IMG_RELEASE}.zip" > "${IMG_RELEASE}.zip" + unzip -q "${IMG_RELEASE}.zip" + rm -rf "/opt/${APP}/img" + mv "${APP}-img-${IMG_RELEASE:1}" "/opt/${APP}/img" + echo "${IMG_RELEASE}" >"/opt/${APP}_IMG_version.txt" + msg_ok "Updating 5etools images" + + chown -R www-data: "/opt/${APP}" + chmod -R 755 "/opt/${APP}" + + # Cleaning up + msg_info "Cleaning Up" + rm "${IMG_RELEASE}.zip" + $STD apt-get -y autoremove + $STD apt-get -y autoclean + msg_ok "Cleanup Completed" + else + msg_ok "No update required. ${APP} images are already at ${IMG_RELEASE}" + fi + +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}" diff --git a/install/5etools-install.sh b/install/5etools-install.sh new file mode 100644 index 00000000..4254ef0c --- /dev/null +++ b/install/5etools-install.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: TheRealVira +# License: MIT +# Source: https://5e.tools/ + +# Import Functions und Setup +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + mc \ + sudo \ + git \ + apache2 +msg_ok "Installed Dependencies" + +# Setup App +msg_info "Set up base 5etools" +RELEASE=$(curl -s https://api.github.com/repos/5etools-mirror-3/5etools-src/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +wget -q "https://github.com/5etools-mirror-3/5etools-src/archive/refs/tags/${RELEASE}.zip" +unzip -q "${RELEASE}.zip" +mv "5etools-src-${RELEASE:1}" /opt/5etools +echo "${RELEASE}" >"/opt/5etools_version.txt" +rm "${RELEASE}.zip" +msg_ok "Set up base 5etools" + +msg_info "Set up 5etools images" +IMG_RELEASE=$(curl -s https://api.github.com/repos/5etools-mirror-2/5etools-img/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +curl -sSL "https://github.com/5etools-mirror-2/5etools-img/archive/refs/tags/${IMG_RELEASE}.zip" > "${IMG_RELEASE}.zip" +unzip -q "${IMG_RELEASE}.zip" +mv "5etools-img-${IMG_RELEASE:1}" /opt/5etools/img +echo "${IMG_RELEASE}" >"/opt/5etools_IMG_version.txt" +rm "${IMG_RELEASE}.zip" +msg_ok "Set up 5etools images" + +msg_info "Creating Service" +cat <> /etc/apache2/apache2.conf + + SetHandler server-status + Order deny,allow + Allow from all + +EOF +rm -rf /var/www/html +ln -s "/opt/5etools" /var/www/html + +chown -R www-data: "/opt/5etools" +chmod -R 755 "/opt/5etools" +apache2ctl start +msg_ok "Creating Service" +# Cleanup +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" + +motd_ssh +customize diff --git a/json/5etools.json b/json/5etools.json new file mode 100644 index 00000000..2900dda6 --- /dev/null +++ b/json/5etools.json @@ -0,0 +1,34 @@ +{ + "name": "5etools", + "slug": "5etools", + "categories": [ + 0 + ], + "date_created": "2025-01-02", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 80, + "documentation": "https://wiki.tercept.net/en/5eTools", + "website": "https://5e.tools/", + "logo": "https://wiki.tercept.net/core-wiki-assets/5etoolslogocircle.png", + "description": "5eTools is a website providing a suite of tools for 5th Edition Dungeons & Dragons players and Dungeon Masters.", + "install_methods": [ + { + "type": "default", + "script": "ct/5etools.sh", + "resources": { + "cpu": 1, + "ram": 512, + "hdd": 13, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] +} From e356259785b8c98373e7e87f8ac44e4a5832e550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=BChrig?= Date: Thu, 2 Jan 2025 20:29:49 +0100 Subject: [PATCH 3/9] New Script: Pf2eTools (#1162) * Testing 5etools. * Introducing Pf2eTools * Replacing name with var. * Switched to release crawling. * Re-added git. * Update Pf2eTools-install.sh * Update Pf2eTools-install.sh * Update Pf2eTools-install.sh * Update Pf2eTools.sh * Update Pf2eTools-install.sh * Update Pf2eTools.sh * Update Pf2eTools.sh * Update Pf2eTools-install.sh * Update Pf2eTools.sh * Update Pf2eTools-install.sh * Update Pf2eTools.sh Fix update script * Update Pf2eTools.json --------- Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com> --- ct/Pf2eTools.sh | 78 ++++++++++++++++++++++++++++++++++++ install/Pf2eTools-install.sh | 58 +++++++++++++++++++++++++++ json/Pf2eTools.json | 34 ++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 ct/Pf2eTools.sh create mode 100644 install/Pf2eTools-install.sh create mode 100644 json/Pf2eTools.json diff --git a/ct/Pf2eTools.sh b/ct/Pf2eTools.sh new file mode 100644 index 00000000..43d693c8 --- /dev/null +++ b/ct/Pf2eTools.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: TheRealVira +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://pf2etools.com/ + +# App Default Values +APP="Pf2eTools" +var_tags="wiki" +var_cpu="1" +var_ram="512" +var_disk="6" +var_os="debian" +var_version="12" +var_unprivileged="1" + +# App Output & Base Settings +header_info "$APP" +base_settings + +# Core +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + # Check if installation is present | -f for file, -d for folder + if [[ ! -d "/opt/${APP}" ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + RELEASE=$(curl -s https://api.github.com/repos/Pf2eToolsOrg/Pf2eTools/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f "/opt/${APP}_version.txt" ]]; then + # Crawling the new version and checking whether an update is required + msg_info "Updating System" + apt-get update &>/dev/null + apt-get -y upgrade &>/dev/null + msg_ok "Updated System" + + # Execute Update + msg_info "Updating ${APP}" + cd "/opt/${APP}" + wget -q "https://github.com/Pf2eToolsOrg/Pf2eTools/archive/refs/tags/${RELEASE}.zip" + unzip -q "${RELEASE}.zip" + rm -rf "/opt/${APP}" + mv "${APP}-${RELEASE:1}" "/opt/${APP}" + echo "${RELEASE}" >"/opt/${APP}_version.txt" + msg_ok "Updated ${APP}" + + chown -R www-data: "/opt/${APP}" + chmod -R 755 "/opt/${APP}" + + # Cleaning up + msg_info "Cleaning Up" + rm "${RELEASE}.zip" + $STD apt-get -y autoremove + $STD apt-get -y autoclean + msg_ok "Cleanup Completed" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}" diff --git a/install/Pf2eTools-install.sh b/install/Pf2eTools-install.sh new file mode 100644 index 00000000..d245d346 --- /dev/null +++ b/install/Pf2eTools-install.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: TheRealVira +# License: MIT +# Source: https://pf2etools.com/ + +# Import Functions und Setup +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + mc \ + sudo \ + apache2 \ + git +msg_ok "Installed Dependencies" + +# Setup App +msg_info "Setup Pf2eTools" +RELEASE=$(curl -s https://api.github.com/repos/Pf2eToolsOrg/Pf2eTools/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +wget -q "https://github.com/Pf2eToolsOrg/Pf2eTools/archive/refs/tags/${RELEASE}.zip" +unzip -q "${RELEASE}.zip" +mv "Pf2eTools-${RELEASE:1}" /opt/Pf2eTools +echo "${RELEASE}" >/opt/Pf2eTools_version.txt +msg_ok "Set up Pf2eTools" + +msg_info "Creating Service" +cat <> /etc/apache2/apache2.conf + + SetHandler server-status + Order deny,allow + Allow from all + +EOF +rm -rf /var/www/html +ln -s "/opt/Pf2eTools" /var/www/html + +chown -R www-data: "/opt/Pf2eTools" +chmod -R 755 "/opt/Pf2eTools" +apache2ctl start +msg_ok "Creating Service" +# Cleanup +msg_info "Cleaning up" +rm "${RELEASE}.zip" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" + +motd_ssh +customize diff --git a/json/Pf2eTools.json b/json/Pf2eTools.json new file mode 100644 index 00000000..0dbb2b47 --- /dev/null +++ b/json/Pf2eTools.json @@ -0,0 +1,34 @@ +{ + "name": "Pf2eTools", + "slug": "Pf2eTools", + "categories": [ + 0 + ], + "date_created": "2025-01-02", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 80, + "documentation": "https://github.com/Pf2eToolsOrg/Pf2eTools/wiki", + "website": "https://pf2etools.com/", + "logo": "https://raw.githubusercontent.com/Pf2eToolsOrg/Pf2eTools/refs/heads/dev/android-chrome-192x192.png", + "description": "Pf2eTools is an open-source website aiming to provide tools and information for Pathfinder 2nd Edition players and gamemasters. It's built using basic web technologies to ensure wide compatibility, and utilises client-side caching for speed, efficiency, and offline access.", + "install_methods": [ + { + "type": "default", + "script": "ct/Pf2eTools.sh", + "resources": { + "cpu": 1, + "ram": 512, + "hdd": 6, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] +} From c72eb13e747a5addb47735439eafeea0e83722ee Mon Sep 17 00:00:00 2001 From: "community-scripts-pr-app[bot]" <189241966+community-scripts-pr-app[bot]@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:31:58 +0100 Subject: [PATCH 4/9] Update CHANGELOG.md (#1183) Co-authored-by: github-actions[bot] --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02e92081..2923514f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,19 @@ All LXC instances created using this repository come pre-installed with Midnight > [!IMPORTANT] Do not break established syntax in this file, as it is automatically updated by a Github Workflow +## 2025-01-02 + +### Changed + +### ✨ New Scripts + +- New Script: Pf2eTools [@TheRealVira](https://github.com/TheRealVira) ([#1162](https://github.com/community-scripts/ProxmoxVE/pull/1162)) +- New Script: 5etools [@TheRealVira](https://github.com/TheRealVira) ([#1157](https://github.com/community-scripts/ProxmoxVE/pull/1157)) + +### 🚀 Updated Scripts + +- Update config template in blocky-install.sh [@xFichtl1](https://github.com/xFichtl1) ([#1059](https://github.com/community-scripts/ProxmoxVE/pull/1059)) + ## 2025-01-01 ### Changed From 585f9a2404a81497465c9320d61f793189d80518 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:37:41 +0100 Subject: [PATCH 5/9] Rename Pf2eTools.sh to pf2etools.sh --- ct/{Pf2eTools.sh => pf2etools.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ct/{Pf2eTools.sh => pf2etools.sh} (100%) diff --git a/ct/Pf2eTools.sh b/ct/pf2etools.sh similarity index 100% rename from ct/Pf2eTools.sh rename to ct/pf2etools.sh From dc0cf2cb3b6bedbb9a1a97e7891dd58c5c105839 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:38:07 +0100 Subject: [PATCH 6/9] Rename Pf2eTools-install.sh to pf2etools-install.sh --- install/{Pf2eTools-install.sh => pf2etools-install.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename install/{Pf2eTools-install.sh => pf2etools-install.sh} (100%) diff --git a/install/Pf2eTools-install.sh b/install/pf2etools-install.sh similarity index 100% rename from install/Pf2eTools-install.sh rename to install/pf2etools-install.sh From eacaca938dd07411f26c39251f91ce412c730f98 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:38:59 +0100 Subject: [PATCH 7/9] Update and rename Pf2eTools.json to pf2etools.json --- json/{Pf2eTools.json => pf2etools.json} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename json/{Pf2eTools.json => pf2etools.json} (96%) diff --git a/json/Pf2eTools.json b/json/pf2etools.json similarity index 96% rename from json/Pf2eTools.json rename to json/pf2etools.json index 0dbb2b47..d50aa5fe 100644 --- a/json/Pf2eTools.json +++ b/json/pf2etools.json @@ -16,7 +16,7 @@ "install_methods": [ { "type": "default", - "script": "ct/Pf2eTools.sh", + "script": "ct/pf2etools.sh", "resources": { "cpu": 1, "ram": 512, From 11de586c930c2b346d60b49724459792b68dd3a1 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:57:38 +0100 Subject: [PATCH 8/9] Update pf2etools-install.sh --- install/pf2etools-install.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/install/pf2etools-install.sh b/install/pf2etools-install.sh index d245d346..c7b8cfae 100644 --- a/install/pf2etools-install.sh +++ b/install/pf2etools-install.sh @@ -42,11 +42,10 @@ cat <> /etc/apache2/apache2.conf EOF rm -rf /var/www/html ln -s "/opt/Pf2eTools" /var/www/html - chown -R www-data: "/opt/Pf2eTools" chmod -R 755 "/opt/Pf2eTools" -apache2ctl start -msg_ok "Creating Service" +msg_ok "Created Service" + # Cleanup msg_info "Cleaning up" rm "${RELEASE}.zip" From 3b8ff01385cc21be38033c5cd2846468fafa10a0 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:59:51 +0100 Subject: [PATCH 9/9] Update 5etools-install.sh --- install/5etools-install.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/install/5etools-install.sh b/install/5etools-install.sh index 4254ef0c..5f9da35d 100644 --- a/install/5etools-install.sh +++ b/install/5etools-install.sh @@ -24,23 +24,23 @@ $STD apt-get install -y \ msg_ok "Installed Dependencies" # Setup App -msg_info "Set up base 5etools" +msg_info "Set up 5etools Base" RELEASE=$(curl -s https://api.github.com/repos/5etools-mirror-3/5etools-src/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') wget -q "https://github.com/5etools-mirror-3/5etools-src/archive/refs/tags/${RELEASE}.zip" unzip -q "${RELEASE}.zip" mv "5etools-src-${RELEASE:1}" /opt/5etools echo "${RELEASE}" >"/opt/5etools_version.txt" rm "${RELEASE}.zip" -msg_ok "Set up base 5etools" +msg_ok "Set up 5etools Base" -msg_info "Set up 5etools images" +msg_info "Set up 5etools Image" IMG_RELEASE=$(curl -s https://api.github.com/repos/5etools-mirror-2/5etools-img/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') curl -sSL "https://github.com/5etools-mirror-2/5etools-img/archive/refs/tags/${IMG_RELEASE}.zip" > "${IMG_RELEASE}.zip" unzip -q "${IMG_RELEASE}.zip" mv "5etools-img-${IMG_RELEASE:1}" /opt/5etools/img echo "${IMG_RELEASE}" >"/opt/5etools_IMG_version.txt" rm "${IMG_RELEASE}.zip" -msg_ok "Set up 5etools images" +msg_ok "Set up 5etools Image" msg_info "Creating Service" cat <> /etc/apache2/apache2.conf @@ -52,12 +52,10 @@ cat <> /etc/apache2/apache2.conf EOF rm -rf /var/www/html ln -s "/opt/5etools" /var/www/html - chown -R www-data: "/opt/5etools" chmod -R 755 "/opt/5etools" -apache2ctl start -msg_ok "Creating Service" -# Cleanup +msg_ok "Created Service" + msg_info "Cleaning up" $STD apt-get -y autoremove $STD apt-get -y autoclean