diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..4cf8cff5 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,132 @@ + +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available +at [https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..2b2bf02d --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,14 @@ +
+ + + +
+

Contributing to Proxmox VE Helper Scripts

+ +Everybody is invited and welcome to contribute to Proxmox VE Helper Scripts. + +- Pull requests submitted against [**main**](https://github.com/tteck/Proxmox/tree/main) are meticulously scrutinized, so please do not take it personally if the project maintainer rejects your request. By adhering to the established patterns and conventions throughout the codebase, you greatly increase the likelihood that your changes will get merged into [**main**](https://github.com/tteck/Proxmox/tree/main). + +- It is important to stress that complaining about a decision after it has been made is not productive behavior for the pull request submitter. It is crucial for all contributors to respect the decision-making process and collaborate effectively towards achieving the best possible outcome for the project. + +- The repository will only accept Alpine applications that make use of the Alpine Package Keeper. diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..8ecf7b04 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +ko_fi: proxmoxhelperscripts diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 00000000..26e62e89 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,65 @@ +name: Problems with a script. +description: Generate a report on an issue pertaining specifically to a script. For other inquires please share them in the Discussions section. +body: + - type: markdown + attributes: + value: | + **IMPORTANT:** Failure to comply with the following guidelines may result in immediate closure. + - Prior to submitting, kindly search the closed issues to check if the problem you are reporting has already been addressed and resolved. If you come across a closed issue that pertains to your problem, please leave a comment on that issue instead of creating a new one. + - If the default Linux distribution is not adhered to, script support will be discontinued. + - When encountering the error message `[ERROR] in line 23: exit code *: while executing command "$@" > /dev/null 2>&1`, make sure to run the script in verbose mode to accurately determine the underlying issue. + - For suggestions, questions or feature/script requests, please share them in the [Discussions section.](https://github.com/tteck/Proxmox/discussions) + - type: input + id: guidelines + attributes: + label: Please verify that you have read and understood the guidelines. + placeholder: 'yes' + validations: + required: true + - type: textarea + id: bug + attributes: + label: A clear and concise description of the issue. + validations: + required: true + - type: dropdown + id: settings + validations: + required: true + attributes: + label: What settings are you currently utilizing? + options: + - + - Default Settings + - Advanced Settings + - type: markdown + attributes: + value: (if Advanced Settings, please try Default Settings before creating an issue) + - type: dropdown + id: distribution + validations: + required: true + attributes: + label: Which Linux distribution are you employing? + options: + - + - Alpine + - Debian 11 + - Debian 12 + - Ubuntu 20.04 + - Ubuntu 22.04 + - Ubuntu 24.04 + - type: textarea + id: screenshot + attributes: + label: If relevant, including screenshots or a code block can be helpful in clarifying the issue. + placeholder: Code blocks begin and conclude by enclosing the code with three backticks (```) above and below it. + validations: + required: false + - type: textarea + id: reproduce + attributes: + label: Please provide detailed steps to reproduce the issue. + placeholder: First do this, then this ... + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..09abbdf7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Helper-Scripts Community Support + url: https://github.com/tteck/Proxmox/discussions + about: Please ask and answer questions here. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..39173ba0 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,18 @@ +## I wanted to make you aware that I am meticulous when it comes to merging code into the main branch, so please don't take it personally if I reject your request. + +## Description + +Please include a summary of the change and/or which issue is fixed. + +Fixes # (issue) + +## Type of change + +Please delete options that are not relevant. + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] New Script (Develop a new script or set of scripts that are fully functional and thoroughly tested) +- [ ] I have performed a self-review of my code, adhering to established codebase patterns and conventions. +- [ ] This change requires a documentation update diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..517cda16 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,2302 @@ +
+ + + +
+

Changelog

+ +

All notable changes to this project will be documented in this file.

+ +- Be cautious of copycat or coat-tailing sites that exploit the project's popularity with potentially malicious intent. Please only trust information from https://Helper-Scripts.com/ or https://tteck.github.io/Proxmox/. + +- All LXC instances created using this repository come pre-installed with Midnight Commander, which is a command-line tool (`mc`) that offers a user-friendly file and directory management interface for the terminal environment. + + +## 2024-06-30 + +### Changed + +- **All Scripts** [(Commit)](https://github.com/tteck/Proxmox/commit/39ea1d4a20b83c07d084ebafdc811eec3548f289) + - Requires Proxmox Virtual Environment version 8.1 or later. + +## 2024-06-27 + +### Changed + +- **Kubo LXC** [(View Source)](https://raw.githubusercontent.com/tteck/Proxmox/main/install/kubo-install.sh) + - NEW Script +- **RabbitMQ LXC** [(View Source)](https://raw.githubusercontent.com/tteck/Proxmox/main/install/rabbitmq-install.sh) + - NEW Script +- **Scrutiny LXC** + - Removed from website, broken. + +## 2024-06-26 + +### Changed + +- **Scrutiny LXC** + - NEW Script + +## 2024-06-14 + +### Changed + +- **MySpeed LXC** [(View Source)](https://raw.githubusercontent.com/tteck/Proxmox/main/install/myspeed-install.sh) + - NEW Script + +## 2024-06-13 + +### Changed + +- **PeaNUT LXC** [(View Source)](https://raw.githubusercontent.com/tteck/Proxmox/main/install/peanut-install.sh) + - NEW Script +- **Website** + - If the Changelog has changed recently, the link on the website will pulse. +- **Spoolman LXC** [(View Source)](https://raw.githubusercontent.com/tteck/Proxmox/main/install/spoolman-install.sh) + - NEW Script + +## 2024-06-12 + +### Changed + +- **MeTube LXC** [(View Source)](https://raw.githubusercontent.com/tteck/Proxmox/main/install/metube-install.sh) + - NEW Script +- **Matterbridge LXC** [(View Source)](https://raw.githubusercontent.com/tteck/Proxmox/main/install/matterbridge-install.sh) + - NEW Script +- **Website** + - Reopen the gh-pages site (https://tteck.github.io/Proxmox/) + +## 2024-06-11 + +### Changed + +- **Zabbix LXC** [(View Source)](https://raw.githubusercontent.com/tteck/Proxmox/main/install/zabbix-install.sh) + - NEW Script + +## 2024-06-06 + +### Changed + +- **Petio LXC** [(View Source)](https://raw.githubusercontent.com/tteck/Proxmox/main/install/petio-install.sh) + - NEW Script +- **Website** + - Important notices will now be displayed on the landing page. + +## 2024-06-04 + +### Changed + +- **FlareSolverr LXC** [(View Source)](https://raw.githubusercontent.com/tteck/Proxmox/main/install/flaresolverr-install.sh) + - NEW Script + +## 2024-05-31 + +### Changed + +- **Advanced Settings** [(Commit)](https://github.com/tteck/Proxmox/commit/fc9dff220b4ea426d3a75178ad8accacae4683ca) + - Passwords are now masked + +## 2024-05-30 + +### Changed + +- **Forgejo LXC** + - NEW Script + +## 2024-05-28 + +### Changed + +- **Notifiarr LXC** + - NEW Script + +## 2024-05-25 + +### Changed + +- **Threadfin LXC** + - NEW Script + +## 2024-05-23 + +### Changed + +- **BunkerWeb LXC** + - NEW Script + +## 2024-05-20 + +### Changed + +- **Traefik LXC** + - NEW Script + +## 2024-05-19 + +### Changed + +- **NetBird** + - NEW Script +- **Tailscale** + - Refactor Code + +## 2024-05-18 + +### Changed + +- **MongoDB LXC** + - NEW Script + +## 2024-05-17 + +### Changed + +- **New Website** + - We have officially moved to [Helper-Scripts.com](https://helper-scripts.com) + +## 2024-05-16 + +### Changed + +- **iVentoy LXC** + - NEW Script + +## 2024-05-13 + +### Changed + +- **Headscale LXC** + - NEW Script + +## 2024-05-11 + +### Changed + +- **Caddy LXC** + - NEW Script + +## 2024-05-09 + +### Changed + +- **Umami LXC** + - NEW Script + +## 2024-05-08 + +### Changed + +- **Kernel Pin** + - NEW Script +- **Home Assistant Core LXC** + - Ubuntu 24.04 ONLY + +## 2024-05-07 + +### Changed + +- **Pocketbase LXC** + - NEW Script + +## 2024-05-05 + +### Changed + +- **Fenrus LXC** + - NEW Script + +## 2024-05-02 + +### Changed + +- **OpenMediaVault LXC** + - Set Debian 12 as default + - OpenMediaVault 7 (sandworm) + +## 2024-04-30 + +### Changed + +- **Tdarr LXC** + - Default settings are now **Unprivileged** + - Unprivileged Hardware Acceleration + +## 2024-04-29 + +### Changed + +- **ErsatzTV LXC** + - NEW Script + +## 2024-04-28 + +### Changed + +- **Scrypted LXC** + - Unprivileged Hardware Acceleration +- **Emby LXC** + - Unprivileged Hardware Acceleration + +## 2024-04-27 + +### Changed + +- **Frigate LXC** + - Unprivileged Hardware Acceleration https://github.com/tteck/Proxmox/discussions/2711#discussioncomment-9244629 +- **Ubuntu 24.04 VM** + - NEW Script + +## 2024-04-26 + +### Changed + +- **Glances** + - NEW Script + +## 2024-04-25 + +### Changed + +- **Jellyfin LXC** + - Default settings are now **Unprivileged** + - Unprivileged Hardware Acceleration + - Groups are set automatically + - Checks for the existence of `/dev/dri/card0` if not found, use `/dev/dri/card1`. Set the GID to `44` + - Set the GID for `/dev/dri/renderD128` to `104` + - Not tested <8.1.11 +- **Plex LXC** + - Default settings are now **Unprivileged** + - Unprivileged Hardware Acceleration + - Groups are set automatically + - Checks for the existence of `/dev/dri/card0` if not found, use `/dev/dri/card1`. Set the GID to `44` + - Set the GID for `/dev/dri/renderD128` to `104` + - Not tested <8.1.11 + +## 2024-04-24 + +### Changed + +- **Traccar LXC** + - NEW Script +- **Calibre-Web LXC** + - NEW Script + +## 2024-04-21 + +### Changed + +- **Aria2 LXC** + - NEW Script + +## 2024-04-15 + +### Changed + +- **Homarr LXC** + - Add back to website +- **Umbrel LXC** + - Add back to website +- **OpenMediaVault LXC** + - Add back to website + +## 2024-04-12 + +### Changed + +- **OpenMediaVault LXC** + - Removed from website + +## 2024-04-09 + +### Changed + +- **PairDrop LXC** + - Add back to website + +## 2024-04-05 + +### Changed + +- **Medusa LXC** + - NEW Script +- **WatchYourLAN LXC** + - NEW Script + +## 2024-04-04 + +### Changed + +- **Actual Budget LXC** + - NEW Script + +## 2024-04-03 + +### Changed + +- **LazyLibrarian LXC** + - NEW Script + +## 2024-04-01 + +### Changed + +- **Frigate LXC** + - NEW Script + +## 2024-03-26 + +### Changed + +- **MediaMTX LXC** + - NEW Script + +## 2024-03-25 + +### Changed + +- **Proxmox VE Post Install** + - ~Requires Proxmox Virtual Environment Version 8.1.1 or later.~ + - Requires Proxmox Virtual Environment Version 8.0 or later. +- **Proxmox Backup Server LXC** + - NEW Script + +## 2024-03-24 + +### Changed + +- **SmokePing LXC** + - NEW Script + +## 2024-03-13 + +### Changed + +- **FlowiseAI LXC** + - NEW Script + +## 2024-03-11 + +### Changed + +- **Wastebin LXC** + - NEW Script + +## 2024-03-08 + +### Changed + +- **Proxmox VE Post Install** + - Requires Proxmox Virtual Environment Version 8.1.1 or later. + +## 2024-02-26 + +### Changed + +- **Mafl LXC** + - NEW Script + +## 2024-02-23 + +### Changed + +- **Tandoor Recipes LXC** + - NEW Script (Thanks @MickLesk) + +## 2024-02-21 + +### Changed + +- **All scripts** + - As of today, the scripts require the Bash shell specifically. ([more info](https://github.com/tteck/Proxmox/discussions/2536)) + +## 2024-02-19 + +### Changed + +- **PairDrop LXC** + - Removed from the website ([more info](https://github.com/tteck/Proxmox/discussions/2516)) + +## 2024-02-16 + +### Changed + +- **Proxmox VE LXC Filesystem Trim** + - NEW Script ([more info](https://github.com/tteck/Proxmox/discussions/2505#discussion-6226037)) + +## 2024-02-11 + +### Changed + +- **HiveMQ CE LXC** + - NEW Script +- **Apache-CouchDB LXC** + - NEW Script + +## 2024-02-06 + +### Changed + +- **All Scripts** + - The scripts will only work with PVE7 Version 7.4-13 or later, or PVE8 Version 8.1.1 or later. + +## 2024-02-05 + +### Changed + +- **Gokapi LXC** + - NEW Script +- **Nginx Proxy Manager LXC** + - Option to install v2.10.4 + +## 2024-02-04 + +### Changed + +- **Pi-hole LXC** + - Option to add Unbound + +## 2024-02-02 + +### Changed + +- **Readeck LXC** + - NEW Script + +## 2024-01-25 + +### Changed + +- **PairDrop LXC** + - NEW Script + +## 2024-01-20 + +### Changed + +- **Apache-Cassandra LXC** + - NEW Script +- **Redis LXC** + - NEW Script + +## 2024-01-17 + +### Changed + +- **ntfy LXC** + - NEW Script +- **HyperHDR LXC** + - NEW Script + +## 2024-01-16 + +### Changed + +- **Website Improvements** + - Refine and correct pointers. + - Change hover colors to intuitively indicate categories/items. + - Implement opening links in new tabs for better navigation. + - Enhance the Copy button to better indicate that the command has been successfully copied. + - Introduce a Clear Search button. + - While not directly related to the website, it's worth mentioning that the logo in newly created LXC notes now serves as a link to the website, conveniently opening in a new tab. + +## 2024-01-12 + +### Changed + +- **Apt-Cacher-NG LXC** + - NEW Script +- **New Feature** + - The option to utilize Apt-Cacher-NG (Advanced settings) when creating LXCs. The added functionality is expected to decrease bandwidth usage and expedite package installation and updates. https://github.com/tteck/Proxmox/discussions/2332 + +## 2024-01-09 + +### Changed + +- **Verbose mode** + - Only entries with `$STD` will be shown + +## 2024-01-07 + +### Changed + +- **Stirling-PDF LXC** + - NEW Script +- **SFTPGo LXC** + - NEW Script + +## 2024-01-04 + +### Changed + +- **CommaFeed LXC** + - NEW Script + +## 2024-01-03 + +### Changed + +- **Sonarr LXC** + - Breaking Change + - Complete recode + - https://github.com/tteck/Proxmox/discussions/1738#discussioncomment-8005107 + +## 2024-01-01 + +### Changed + +- **Gotify LXC** + - NEW Script + +## 2023-12-19 + +### Changed + +- **Proxmox VE Netdata** + - NEW Script + +## 2023-12-10 + +### Changed + +- **Homarr LXC** + - Removed, again. + +## 2023-12-02 + +### Changed + +- **Runtipi LXC** + - NEW Script + +## 2023-12-01 + +### Changed + +- **Mikrotik RouterOS VM** + - Now Mikrotik RouterOS CHR VM + - code refactoring + - update to CHR + - thanks to @NiccyB +- **Channels DVR Server LXC** + - NEW Script + +## 2023-11-19 + +### Changed + +- **Dockge LXC** + - NEW Script + +## 2023-11-18 + +### Changed + +- **Ubuntu 22.04 VM** + - NEW Script + +## 2023-11-14 + +### Changed + +- **TurnKey Nextcloud VM** + - NEW Script +- **TurnKey ownCloud VM** + - NEW Script + +## 2023-11-11 + +### Changed + +- **Homarr LXC** + - Returns with v0.14.0 (The authentication update). + +## 2023-11-9 + +### Changed + +- **AgentDVR LXC** + - NEW Script + +## 2023-11-8 + +### Changed + +- **Linkwarden LXC** + - NEW Script + +## 2023-11-2 + +### Changed + +- **PhotoPrism LXC** + - Transitioned to PhotoPrism's latest installation package, featuring Linux binaries. + +## 2023-11-1 + +### Changed + +- **Owncast LXC** + - NEW Script + +## 2023-10-31 + +### Changed + +- **Debian 12 VM** + - NEW Script + +## 2023-10-29 + +### Changed + +- **Unmanic LXC** + - NEW Script + +## 2023-10-27 + +### Changed + +- **Webmin** + - A full code overhaul. + +## 2023-10-15 + +### Changed + +- **TasmoAdmin LXC** + - NEW Script + +## 2023-10-14 + +### Changed + +- **Sonarr LXC** + - Include an option to install v4 (experimental) + +## 2023-10-11 + +### Changed + +- **Proxmox VE CPU Scaling Governor** + - A full code overhaul. + - Include an option to configure a crontab for ensuring that the CPU Scaling Governor configuration persists across reboots. + +## 2023-10-08 + +### Changed + +- **Proxmox VE LXC Updater** + - Now displays which containers require a reboot. +- **File Browser** + - Uninstall by re-executing the script + - Option to use No Authentication + +## 2023-10-05 + +### Changed + +- **Pingvin Share LXC** + - NEW Script + +## 2023-09-30 + +### Changed + +- **All Templates** + - NEW Script + +## 2023-09-28 + +### Changed + +- **Alpine Nextcloud Hub LXC** + - NEW Script (Thanks to @nicedevil007) + +## 2023-09-14 + +### Changed + +- **Proxmox VE Processor Microcode** + - Allow users to select available microcode packages. + +## 2023-09-13 + +### Changed + +- **Pi.Alert LXC** + - NEW Script +- **Proxmox VE Kernel Clean** + - Code overhaul with a fresh start. This script offers the flexibility to select specific kernels for removal, unlike the previous version, which was an all-or-nothing approach. + +## 2023-09-11 + +### Changed + +- **Paperless-ngx LXC** + - Modify the script to incorporate Redis and PostgreSQL, while also introducing an option to include Adminer during installation. + +## 2023-09-10 + +### Changed + +- **TurnKey Game Server LXC** + - NEW Script + +## 2023-09-09 + +### Changed + +- **Proxmox VE Host Backup** + - Users are now able to specify both the backup path and the directory in which they wish to work. + +## 2023-09-07 + +### Changed + +- **Proxmox VE Host Backup** + - NEW Script + +## 2023-09-06 + +### Changed + +- **Proxmox VE LXC Cleaner** + - Added a new menu that allows you to choose which containers you want to exclude from the clean process. +- **Tailscale** + - Added a menu that enables you to choose the specific container where you want to install Tailscale. + +## 2023-09-05 + +### Changed + +- **Proxmox VE LXC Updater** + - Added a new menu that allows you to choose which containers you want to exclude from the update process. + +## 2023-09-01 + +### Changed + +- **TurnKey Media Server LXC** + - NEW Script + +## 2023-08-31 + +### Changed + +- **TurnKey ZoneMinder LXC** + - NEW Script +- **TurnKey OpenVPN LXC** + - NEW Script + +## 2023-08-30 + +### Changed + +- **TurnKey** + - Introducing a **NEW** Category on the Site. + - My intention is to maintain the TurnKey scripts in their simplest form, contained within a single file, and with minimal options, if any. +- **TurnKey Core LXC** + - NEW Script +- **TurnKey File Server LXC** + - NEW Script +- **TurnKey Gitea LXC** + - NEW Script +- **TurnKey GitLab LXC** + - NEW Script +- **TurnKey Nextcloud LXC** + - NEW Script +- **TurnKey Observium LXC** + - NEW Script +- **TurnKey ownCloud LXC** + - NEW Script +- **TurnKey Torrent Server LXC** + - NEW Script +- **TurnKey Wordpress LXC** + - NEW Script + +## 2023-08-24 + +### Changed + +- **qBittorrent LXC** + - Added back to repository with UPnP disabled and password changed. + +## 2023-08-24 + +### Changed + +- **qBittorrent LXC** + - Removed from this repository for potential malicious hidden code https://github.com/tteck/Proxmox/discussions/1725 + +## 2023-08-16 + +### Changed + +- **Homarr LXC** + - NEW Script + +## 2023-08-10 + +### Changed + +- **Proxmox VE Processor Microcode** + - AMD microcode-20230808 Release + +## 2023-08-09 + +### Changed + +- **Omada Controller LXC** + - Update via script +- **Proxmox VE Processor Microcode** + - [Intel microcode-20230808 Release](https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/releases/tag/microcode-20230808) + +## 2023-08-01 + +### Changed + +- **Overseerr LXC** + - NEW Script +- **Jellyseerr LXC** + - NEW Script + +## 2023-07-24 + +### Changed + +- **Ombi LXC** + - NEW Script + +## 2023-07-23 + +### Changed + +- **Zoraxy LXC** + - NEW Script + +## 2023-07-18 + +### Changed + +- **Proxmox VE Cron LXC Updater** + - NEW Script + +## 2023-07-11 + +### Changed + +- **Scrypted LXC** + - Add VAAPI hardware transcoding + +## 2023-07-07 + +### Changed + +- **Real-Debrid Torrent Client LXC** + - NEW Script + +## 2023-07-05 + +### Changed + +- There have been more than 110 commits since June 18th, although not all of them are significant, with a majority focused on ensuring compatibility with Proxmox VE 8 and Debian 12. + +## 2023-06-18 + +### Changed + +- **OpenObserve LXC** + - NEW Script + +## 2023-06-17 + +### Changed + +- **UniFi Network Application LXC** + - Now distribution agnostic. +- **Omada Controller LXC** + - Now distribution agnostic. +## 2023-06-16 + +### Changed + +- **Proxmox VE Monitor-All** + - Skip instances based on onboot and templates. [8c2a3cc](https://github.com/tteck/Proxmox/commit/8c2a3cc4d774fa13d17f695d6bdf9a4deedb1372). + +## 2023-06-12 + +### Changed + +- **Proxmox VE Edge Kernel** + - Removed, with the Proxmox opt-in kernels and the upcoming Proxmox Virtual Environment 8, edge kernels are no longer needed. +- **Proxmox VE Kernel Clean** + - Now compatible with PVE8. + +## 2023-06-11 + +### Changed + +- **Proxmox VE Post Install** + - Now compatible with both Proxmox Virtual Environment 7 (PVE7) and Proxmox Virtual Environment 8 (PVE8). + +## 2023-06-02 + +### Changed + +- **Proxmox VE 7 Post Install** + - In a non-clustered environment, you can choose to disable high availability, which helps save system resources. + +## 2023-05-27 + +### Changed + +- **Proxmox VE 7 Post Install** + - If an Intel N-series processor is detected, ~the script provides options to install both the Proxmox 6.2 kernel and the Intel microcode.~ and using PVE7, recommend using PVE8 + +## 2023-05-23 + +### Changed + +- **OpenWrt VM** + - NEW Script + +## 2023-05-17 + +### Changed + +- **Alpine-AdGuard Home LXC** + - Removed, it wasn't installed through the Alpine package manager. +- **Alpine-Whoogle LXC** + - Removed, it wasn't installed through the Alpine package manager. + +## 2023-05-16 + +### Changed + +- **Proxmox VE LXC Updater** + - Add information about the boot disk, which provides an easy way to determine if you need to expand the disk. +- **Proxmox VE Processor Microcode** + - [Intel microcode-20230512 Release](https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/releases/tag/microcode-20230512) + +## 2023-05-13 + +### Changed + +- **Tautulli LXC** + - NEW Script + +## 2023-05-12 + +### Changed + +- **Bazarr LXC** + - NEW Script + +## 2023-05-08 + +### Changed + +- **Proxmox VE Intel Processor Microcode** + - Renamed to **Proxmox VE Processor Microcode** + - Automatically identifies the processor vendor (Intel/AMD) and installs the appropriate microcode. + +## 2023-05-07 + +### Changed + +- **FHEM LXC** + - NEW Script + +## 2023-05-01 + +### Changed + +- **OctoPrint LXC** + - NEW Script +- **Proxmox VE Intel Processor Microcode** + - NEW Script + +## 2023-04-30 + +### Changed + +- **Proxmox VE Monitor-All** + - NEW Script + - Replaces Proxmox VE LXC Monitor + +## 2023-04-28 + +### Changed + +- **Proxmox VE LXC Monitor** + - NEW Script + +## 2023-04-26 + +### Changed + +- **The site can now be accessed through a more memorable URL, which is [helper-scripts.com](http://helper-scripts.com).** + +## 2023-04-23 + +### Changed + +- **Non-Alpine LXC's** + - Advanced settings provide the option for users to switch between Debian and Ubuntu distributions. However, some applications or services, such as Deconz, grocy or Omada, may not be compatible with the selected distribution due to dependencies. + +## 2023-04-16 + +### Changed + +- **Home Assistant Core LXC** + - Python 3.11.2 + +## 2023-04-15 + +### Changed + +- **InfluxDB LXC** + - Choosing InfluxDB v1 will result in Chronograf being installed automatically. +- **[User Submitted Guides](https://github.com/tteck/Proxmox/blob/main/USER_SUBMITTED_GUIDES.md)** + - Informative guides that demonstrate how to install various software packages using Proxmox VE Helper Scripts. + +## 2023-04-14 + +### Changed + +- **Cloudflared LXC** + - NEW Script + +## 2023-04-05 + +### Changed + +- **Jellyfin LXC** + - Set Ubuntu 22.04 as default + - Use the Deb822 format jellyfin.sources configuration (jellyfin.list configuration has been obsoleted) + +## 2023-04-02 + +### Changed + +- **Home Assistant OS VM** + - Include a choice within the "Advanced" settings to configure the CPU model between kvm64 (default) or host. + +## 2023-03-31 + +### Changed + +- **Home Assistant OS VM** + - Include a choice within the "Advanced" settings to configure the disk cache between none (default) or Write Through. + +## 2023-03-27 + +### Changed + +- **Removed Alpine-ESPHome LXC** + - Nonoperational +- **All Scripts** + - Incorporate code that examines whether SSH is being used and, if yes, offers a suggestion against it without restricting or blocking its usage. + +## 2023-03-25 + +### Changed + +- **Alpine-ESPHome LXC** + - NEW Script +- **Alpine-Whoogle LXC** + - NEW Script + +## 2023-03-22 + +### Changed + +- **The latest iteration of the scripts** + - Going forward, versioning will no longer be utilized in order to avoid breaking web-links in blogs and YouTube videos. + - The scripts have been made more legible as the repetitive code has been moved to function files, making it simpler to share among the scripts and hopefully easier to maintain. This also makes it simpler to contribute to the project. + - When a container is created with privileged mode enabled, the USB passthrough feature is automatically activated. + +## 2023-03-18 + +### Changed + +- **Alpine-AdGuard Home LXC** (Thanks @nicedevil007) + - NEW Script +- **Alpine-Docker LXC** + - NEW Script +- **Alpine-Zigbee2MQTT LXC** + - NEW Script + +## 2023-03-15 + +### Changed + +- **Alpine-Grafana LXC** (Thanks @nicedevil007) + - NEW Script + +## 2023-03-10 + +### Changed + +- **Proxmox LXC Updater** + - You can use the command line to exclude multiple containers simultaneously. + +## 2023-03-08 + +### Changed + +- **Proxmox CPU Scaling Governor** + - Menu options dynamically based on the available scaling governors. + +## 2023-03-07 + +### Changed + +- **Alpine-Vaultwarden LXC** + - NEW Script +- **All LXC Scripts** + - Retrieve the time zone from Proxmox and configure the container to use the same time zone + +## 2023-02-24 + +### Changed + +- **qBittorrent LXC** (Thanks @romka777) + - NEW Script +- **Jackett LXC** (Thanks @romka777) + - NEW Script + +## 2023-02-23 + +### Changed + +- **Proxmox LXC Updater** + - Skip all templates, allowing for the starting, updating, and shutting down of containers to be resumed automatically. + - Exclude an additional container by adding the CTID at the end of the shell command ( -s 103). + +## 2023-02-16 + +### Changed + +- **RSTPtoWEB LXC** + - NEW Script +- **go2rtc LXC** + - NEW Script + +## 2023-02-12 + +### Changed + +- **OliveTin** + - NEW Script + +## 2023-02-10 + +### Changed + +- **Home Assistant OS VM** + - Code Refactoring + +## 2023-02-05 + +### Changed + +- **Devuan LXC** + - NEW Script + +## 2023-02-02 + +### Changed + +- **Audiobookshelf LXC** + - NEW Script +- **Rocky Linux LXC** + - NEW Script + +## 2023-01-28 + +### Changed + +- **LXC Cleaner** + - Code refactoring to give the user the option to choose whether cache or logs will be deleted for each app/service. + - Leaves directory structure intact + +## 2023-01-27 + +### Changed + +- **LXC Cleaner** + - NEW Script + +## 2023-01-26 + +### Changed + +- **ALL LXC's** + - Add an option to disable IPv6 (Advanced) + +## 2023-01-25 + +### Changed + +- **Home Assistant OS VM** + - switch to v5 + - add an option to set MTU size (Advanced) + - add arch check (no ARM64) (issue from community.home-assistant.io) + - add check to insure VMID isn't already used before VM creation (Advanced) (issue from forum.proxmox.com) + - code refactoring +- **PiMox Home Assistant OS VM** + - switch to v5 + - add an option to set MTU size (Advanced) + - add arch check (no AMD64) + - add pve check (=>7.2) + - add check to insure VMID isn't already used before VM creation (Advanced) + - code refactoring +- **All LXC's** + - add arch check (no ARM64) (issue from forum.proxmox.com) + +## 2023-01-24 + +### Changed + +- **Transmission LXC** + - NEW Script + +## 2023-01-23 + +### Changed + +- **ALL LXC's** + - Add [Midnight Commander (mc)](https://www.linuxcommand.org/lc3_adv_mc.php) + +## 2023-01-22 + +### Changed + +- **Autobrr LXC** + - NEW Script + +## 2023-01-21 + +### Changed + +- **Kavita LXC** + - NEW Script + +## 2023-01-19 + +### Changed + +- **SABnzbd LXC** + - NEW Script + +## 2023-01-17 + +### Changed + +- **Homer LXC** + - NEW Script + +## 2023-01-14 + +### Changed + +- **Tdarr LXC** + - NEW Script +- **Deluge LXC** + - NEW Script + +## 2023-01-13 + +### Changed + +- **Lidarr LXC** + - NEW Script +- **Prowlarr LXC** + - NEW Script +- **Radarr LXC** + - NEW Script +- **Readarr LXC** + - NEW Script +- **Sonarr LXC** + - NEW Script +- **Whisparr LXC** + - NEW Script + +## 2023-01-12 + +### Changed + +- **ALL LXC's** + - Add an option to set MTU size (Advanced) + +## 2023-01-11 + +### Changed + +- **Home Assistant Core LXC** + - Auto Initialize +- **Cronicle Primary/Worker LXC** + - NEW Script + +## 2023-01-09 + +### Changed + +- **ALL LXC's** + - v5 +- **k0s Kubernetes LXC** + - NEW Script +- **Podman LXC** + - NEW Script + +## 2023-01-04 + +### Changed + +- **YunoHost LXC** + - NEW Script + +## 2022-12-31 + +### Changed + +- **v5 Scripts** (Testing before moving forward https://github.com/tteck/Proxmox/discussions/881) + - Adguard Home LXC + - Docker LXC + - Home Assistant Core LXC + - PhotoPrism LXC + - Shinobi NVR LXC + - Vaultwarden LXC + +## 2022-12-27 + +### Changed + +- **Home Assistant Container LXC** + - Add an option to use Fuse Overlayfs (ZFS) (Advanced) + +- **Docker LXC** + - Add an option to use Fuse Overlayfs (ZFS) (Advanced) + - If the LXC is created Privileged, the script will automatically set up USB passthrough. + +## 2022-12-22 + +### Changed + +- **All LXC's** + - Add an option to run the script in Verbose Mode (Advanced) + +## 2022-12-20 + +### Changed + +- **Hyperion LXC** + - NEW Script + +## 2022-12-17 + +### Changed + +- **Home Assistant Core LXC** + - Linux D-Bus Message Broker + - Mariadb & PostgreSQL Ready + - Bluetooth Ready + - Fix for Inconsistent Dependency Versions (dbus-fast & bleak) + +## 2022-12-16 + +### Changed + +- **Home Assistant Core LXC** + - Python 3.10.8 + +## 2022-12-09 + +### Changed + +- **Change Detection LXC** + - NEW Script + +## 2022-12-03 + +### Changed + +- **All LXC's** + - Add options to set DNS Server IP Address and DNS Search Domain (Advanced) + +## 2022-11-27 + +### Changed + +- **Shinobi LXC** + - NEW Script + +## 2022-11-24 + +### Changed + +- **Home Assistant OS VM** + - Add option to set machine type during VM creation (Advanced) + +## 2022-11-23 + +### Changed + +- **All LXC's** + - Add option to enable root ssh access during LXC creation (Advanced) + +## 2022-11-21 + +### Changed + +- **Proxmox LXC Updater** + - Now updates Ubuntu, Debian, Devuan, Alpine Linux, CentOS-Rocky-Alma, Fedora, ArchLinux [(@Uruknara)](https://github.com/tteck/Proxmox/commits?author=Uruknara) + +## 2022-11-13 + +### Changed + +- **All LXC's** + - Add option to continue upon Internet NOT Connected + +## 2022-11-11 + +### Changed + +- **HA Bluetooth Integration Preparation** + - [NEW Script](https://github.com/tteck/Proxmox/discussions/719) + +## 2022-11-04 + +### Changed + +- **Scrypted LXC** + - NEW Script + +## 2022-11-01 + +### Changed + +- **Alpine LXC** + - NEW Script +- **Arch LXC** + - NEW Script + +## 2022-10-27 + +### Changed + +- **Container & Core Restore from Backup** + - [NEW Scripts](https://github.com/tteck/Proxmox/discussions/674) + +## 2022-10-07 + +### Changed + +- **Home Assistant OS VM** + - Add "Latest" Image + +## 2022-10-05 + +### Changed + +- **Umbrel LXC** + - NEW Script (Docker) +- **Blocky LXC** + - NEW Script (Adblocker - DNS) + +## 2022-09-29 + +### Changed + +- **Home Assistant Container LXC** + - If the LXC is created Privileged, the script will automatically set up USB passthrough. +- **Home Assistant Core LXC** + - NEW Script +- **PiMox HAOS VM** + - NEW Script + +## 2022-09-23 + +### Changed + +- **EMQX LXC** + - NEW Script + +## 2022-09-22 + +### Changed + +- **NextCloudPi LXC** + - NEW Script + +## 2022-09-21 + +### Changed + +- **Proxmox Backup Server Post Install** + - NEW Script +- **Z-wave JS UI LXC** + - NEW Script (and all sub scripts 🤞) +- **Zwave2MQTT LXC** + - Bye Bye Script + +## 2022-09-20 + +### Changed + +- **OpenMediaVault LXC** + - NEW Script + +## 2022-09-16 + +### Changed + +- **Paperless-ngx LXC** + - NEW Script (Thanks @Donkeykong307) + +## 2022-09-11 + +### Changed + +- **Trilium LXC** + - NEW Script + +## 2022-09-10 + +### Changed + +- **Syncthing LXC** + - NEW Script + +## 2022-09-09 + +### Changed + +- **CasaOS LXC** + - NEW Script +- **Proxmox Kernel Clean** + - Now works with Proxmox Backup Server + +## 2022-09-08 + +### Changed + +- **Navidrome LXC** + - NEW Script +- **Homepage LXC** + - NEW Script + +## 2022-08-31 + +### Changed + +- **All LXC's** + - Add Internet & DNS Check + +## 2022-08-22 + +### Changed + +- **Wiki.js LXC** + - NEW Script +- **Emby Media Server LXC** + - NEW Script + +## 2022-08-20 + +### Changed + +- **Mikrotik RouterOS VM** + - NEW Script + +## 2022-08-19 + +### Changed + +- **PhotoPrism LXC** + - Fixed .env bug (Thanks @cklam2) + +## 2022-08-13 + +### Changed + +- **Home Assistant OS VM** + - Option to create VM using Stable, Beta or Dev Image + +## 2022-08-11 + +### Changed + +- **Home Assistant OS VM** + - Validate Storage + +## 2022-08-04 + +### Changed + +- **VS Code Server** + - NEW Script + +## 2022-08-02 + +### Changed + +- **All LXC/VM** + - v4 Script - Whiptail menu's + +## 2022-07-26 + +### Changed + +- **Home Assistant OS VM** + - Set the real time clock (RTC) to local time. + - Disable the USB tablet device (save resources / not needed). + +## 2022-07-24 + +### Changed + +- **Home Assistant OS VM** + - Present the drive to the guest as a solid-state drive rather than a rotational hard disk. There is no requirement that the underlying storage actually be backed by SSD's. + - When the VM’s filesystem marks blocks as unused after deleting files, the SCSI controller will relay this information to the storage, which will then shrink the disk image accordingly. + - 👉 [more info](https://github.com/tteck/Proxmox/discussions/378) + +## 2022-07-22 + +### Changed + +- **n8n LXC** (thanks to @cyakimov) + - NEW Script + +## 2022-07-21 + +### Changed + +- **grocy LXC** + - NEW Script + +## 2022-07-17 + +### Changed + +- **Vaultwarden LXC** + - NEW Vaultwarden Update (post 2022-05-29 installs only) Script + - NEW Web-vault Update (any) Script + +## 2022-07-14 + +### Changed + +- **MagicMirror Server LXC** + - NEW Script + +## 2022-07-13 + +### Changed + +- **Proxmox Edge Kernel Tool** + - NEW Script + +## 2022-07-11 + +### Changed + +- **Home Assistant OS VM** + - Supports lvmthin, zfspool, nfs, dir and btrfs storage types. + +## 2022-07-08 + +### Changed + +- **openHAB LXC** + - NEW Script + +## 2022-07-03 + +### Changed + +- **Tailscale** + - NEW Script + +## 2022-07-01 + +### Changed + +- **Home Assistant OS VM** + - Allow different storage types (lvmthin, nfs, dir). + +## 2022-06-30 + +### Changed + +- **Prometheus LXC** + - NEW Script + +## 2022-06-06 + +### Changed + +- **Whoogle LXC** + - NEW Script + +## 2022-05-29 + +### Changed + +- **Vaultwarden LXC** + - Code refactoring +- **CrowdSec** + - NEW Script + +## 2022-05-21 + +### Changed + +- **Home Assistant OS VM** + - Code refactoring + +## 2022-05-19 + +### Changed + +- **Keycloak LXC** + - NEW Script + +## 2022-05-18 + +### Changed + +- **File Browser** + - NEW Script + +## 2022-05-13 + +### Changed + +- **PostgreSQL LXC** + - NEW Script + +## 2022-05-10 + +### Changed + +- **deCONZ LXC** + - NEW Script + +## 2022-05-07 + +### Changed + +- **NocoDB LXC** + - ADD update script + +## 2022-05-06 + +### Changed + +- **PhotoPrism LXC** + - ADD GO Dependencies for full functionality + +## 2022-05-05 + +### Changed + +- **Ubuntu LXC** + - ADD option to define version (18.04 20.04 21.10 22.04) + +## 2022-04-28 + +### Changed + +- **v3 Script** + - Remove Internet Check + +## 2022-04-27 + +### Changed + +- **Home Assistant OS VM** + - ADD Option to set Bridge, VLAN and MAC Address +- **v3 Script** + - Improve Internet Check (prevent ‼ ERROR 4@57) + +## 2022-04-26 + +### Changed + +- **Home Assistant OS VM** + - Fixed bad path + - ADD Option to create VM using Latest or Stable image +- **UniFi Network Application LXC** + - ADD Local Controller Option + +## 2022-04-25 + +### Changed + +- **v3 Script** + - Improve Error Handling + +## 2022-04-23 + +### Changed + +- **v3 Script** + - ADD Internet Connection Check +- **Proxmox VE 7 Post Install** + - NEW v3 Script +- **Proxmox Kernel Clean** + - NEW v3 Script + +## 2022-04-22 + +### Changed + +- **Omada Controller LXC** + - Update script to install version 5.1.7 +- **Uptime Kuma LXC** + - ADD Update script + +## 2022-04-20 + +### Changed + +- **Ubuntu LXC** + - ADD option to install version 20.04 or 21.10 +- **v3 Script** + - ADD option to set Bridge + +## 2022-04-19 + +### Changed + +- **ALL LXC's** + - New [V3 Install Script](https://github.com/tteck/Proxmox/issues/162) +- **ioBroker LXC** + - New Script V3 + +## 2022-04-13 + +### Changed + +- **Uptime Kuma LXC** + - New Script V2 + +## 2022-04-11 + +### Changed + +- **Proxmox LXC Updater** + - ADD option to skip stopped containers +- **Proxmox VE 7 Post Install** + - ADD PVE 7 check + +## 2022-04-10 + +### Changed + +- **Debian 11 LXC** + - ADD An early look at the v3 install script + +## 2022-04-09 + +### Changed + +- **NocoDB LXC** + - New Script V2 + +## 2022-04-05 + +### Changed + +- **MeshCentral LXC** + - New Script V2 + +## 2022-04-01 + +### Changed + +- **Scripts** (V2) + - FIX Pressing enter without making a selection first would cause an Error + +## 2022-03-28 + +### Changed + +- **Docker LXC** + - Add Docker Compose Option (@wovalle) + +## 2022-03-27 + +### Changed + +- **Heimdall Dashboard LXC** + - New Update Script + +## 2022-03-26 + +### Changed + +- **UniFi Network Application LXC** + - New Script V2 +- **Omada Controller LXC** + - New Script V2 + +## 2022-03-25 + +### Changed + +- **Proxmox CPU Scaling Governor** + - New Script + + +## 2022-03-24 + +### Changed + +- **Plex Media Server LXC** + - Switch to Ubuntu 20.04 to support HDR tone mapping +- **Docker LXC** + - Add Portainer Option + +## 2022-03-23 + +### Changed + +- **Heimdall Dashboard LXC** + - New Script V2 + +## 2022-03-20 + +### Changed + +- **Scripts** (V2) + - ADD choose between Automatic or Manual DHCP + +## 2022-03-18 + +### Changed + +- **Technitium DNS LXC** + - New Script V2 +- **WireGuard LXC** + - Add WGDashboard + +## 2022-03-17 + +### Changed + +- **Docker LXC** + - New Script V2 + +## 2022-03-16 + +### Changed + +- **PhotoPrism LXC** + - New Update/Branch Script + +## 2022-03-15 + +### Changed + +- **Dashy LXC** + - New Update Script + +## 2022-03-14 + +### Changed + +- **Zwavejs2MQTT LXC** + - New Update Script + +## 2022-03-12 + +### Changed + +- **PhotoPrism LXC** + - New Script V2 + +## 2022-03-11 + +### Changed + +- **Vaultwarden LXC** + - New V2 Install Script + +## 2022-03-08 + +### Changed + +- **Scripts** (V2) + - Choose between Privileged or Unprivileged CT and Automatic or Password Login +- **ESPHome LXC** + - New V2 Install Script +- **Zwavejs2MQTT LXC** + - New V2 Install Script +- **Motioneye LXC** + - New V2 Install Script +- **Pihole LXC** + - New V2 Install Script +- **GamUntu LXC** + - New V2 Install Script + +## 2022-03-06 + +### Changed + +- **Zwavejs2MQTT LXC** + - New GUI script to copy data from one Zwavejs2MQTT LXC to another Zwavejs2MQTT LXC + +## 2022-03-05 + +### Changed + +- **Homebridge LXC** + - New Script V2 + +## 2022-03-04 + +### Changed + +- **Proxmox Kernel Clean** + - New Script + +## 2022-03-03 + +### Changed + +- **WireGuard LXC** + - New Script V2 + +## 2022-03-02 + +### Changed + +- **Proxmox LXC Updater** + - New Script +- **Dashy LXC** + - New Script V2 +- **Grafana LXC** + - New Script V2 +- **InfluxDB/Telegraf LXC** + - New Script V2 + +## 2022-03-01 + +### Changed + +- **Daemon Sync Server LXC** + - New Script V2 + +## 2022-02-28 + +### Changed + +- **Vaultwarden LXC** + - Add Update Script + +## 2022-02-24 + +### Changed + +- **Nginx Proxy Manager LXC** + - New V2 Install Script + +## 2022-02-23 + +### Changed + +- **Adguard Home LXC** + - New V2 Install Script +- **Zigbee2MQTT LXC** + - New V2 Install Script +- **Home Assistant Container LXC** + - Update Menu usability improvements + +## 2022-02-22 + +### Changed + +- **Home Assistant Container LXC** + - New V2 Install Script +- **Node-Red LXC** + - New V2 Install Script +- **Mariadb LXC** + - New V2 Install Script +- **MQTT LXC** + - New V2 Install Script +- **Debian 11 LXC** + - New V2 Install Script +- **Ubuntu 21.10 LXC** + - New V2 Install Script + +## 2022-02-20 + +### Changed + +- **Home Assistant Container LXC** + - New Script to migrate to the latest Update Menu + +## 2022-02-19 + +### Changed + +- **Nginx Proxy Manager LXC** + - Add Update Script +- **Vaultwarden LXC** + - Make unattended install & Cleanup Script + +## 2022-02-18 + +### Changed + +- **Node-Red LXC** + - Add Install [Themes Script](https://raw.githubusercontent.com/tteck/Proxmox/main/misc/images/node-red-themes.png) + +## 2022-02-16 + +### Changed + +- **Home Assistant Container LXC** + - Add Options to [Update Menu](https://raw.githubusercontent.com/tteck/Proxmox/main/misc/images/update-menu.png) + +## 2022-02-14 + +### Changed + +- **Home Assistant Container LXC** + - Add [Update Menu](https://raw.githubusercontent.com/tteck/Proxmox/main/misc/images/update-menu.png) + +## 2022-02-13 + +### Changed + +- **Mariadb LXC** + - Add [Adminer](https://raw.githubusercontent.com/tteck/Proxmox/main/misc/images/adminer.png) (formerly phpMinAdmin), a full-featured database management tool + +## 2022-02-12 + +### Changed + +- **Home Assistant Container LXC (Podman)** + - Add Yacht web interface for managing Podman containers + - new GUI script to copy data from a **Home Assistant LXC** to a **Podman Home Assistant LXC** + - Improve documentation for several LXC's + +## 2022-02-10 + +### Changed + +- **GamUntu LXC** + - New Script +- **Jellyfin Media Server LXC** + - new script to fix [start issue](https://github.com/tteck/Proxmox/issues/29#issue-1127457380) +- **MotionEye NVR LXC** + - New script + +## 2022-02-09 + +### Changed + +- **Zigbee2MQTT LXC** + - added USB passthrough during installation (no extra script) + - Improve documentation +- **Zwavejs2MQTT LXC** + - added USB passthrough during installation (no extra script) +- **Jellyfin Media Server LXC** + - Moved to testing due to issues. + - Changed install method. +- **Home Assistant Container LXC (Podman)** + - add script for easy Home Assistant update + +## 2022-02-06 + +### Changed + +- **Debian 11 LXC** + - Add Docker Support +- **Ubuntu 21.10 LXC** + - Add Docker Support + +## 2022-02-05 + +### Changed + +- **Vaultwarden LXC** + - New script + +## 2022-02-01 + +### Changed + +- **All Scripts** + - Fix issue where some networks were slow to assign a IP address to the container causing scripts to fail. + +## 2022-01-30 + +### Changed + +- **Zigbee2MQTT LXC** + - Clean up / Improve script + - Improve documentation + +## 2022-01-29 + +### Changed + +- **Node-Red LXC** + - Clean up / Improve script + - Improve documentation + +## 2022-01-25 + +### Changed + +- **Jellyfin Media Server LXC** + - new script + +## 2022-01-24 + +### Changed + +- **Plex Media Server LXC** + - better Hardware Acceleration Support + - `va-driver-all` is preinstalled + - now using Ubuntu 21.10 +- **misc** + - new GUI script [(Screenshot)](https://raw.githubusercontent.com/tteck/Proxmox/main/misc/images/pms-copy-data.png) to copy data from one Plex Media Server LXC to another Plex Media Server LXC + + +## Initial Catch up - 2022-01-23 + +### Changed + +- **Plex Media Server LXC** + - add Hardware Acceleration Support + - add script to install Intel Drivers +- **Zwavejs2MQTT LXC** + - new script to solve no auto start at boot +- **Nginx Proxy Manager LXC** + - new script to use Debian 11 +- **Ubuntu 21.10 LXC** + - new script +- **Mariadb LXC** + - add MariaDB Package Repository +- **MQTT LXC** + - add Eclipse Mosquitto Package Repository +- **Home Assistant Container LXC** + - change if ZFS filesystem is detected, execute automatic installation of static fuse-overlayfs + - add script for easy Home Assistant update +- **Home Assistant Container LXC (Podman)** + - change if ZFS filesystem is detected, execute automatic installation of static fuse-overlayfs +- **Home Assistant OS VM** + - change disk type from SATA to SCSI to follow Proxmox official recommendations of choosing VirtIO-SCSI with SCSI disk + - clean up +- **Proxmox VE 7 Post Install** + - new *No-Nag* method +- **misc** + - new GUI script to copy data from one Home Assistant LXC to another Home Assistant LXC + - new GUI script to copy data from one Zigbee2MQTT LXC to another Zigbee2MQTT LXC diff --git a/CODE-AUDIT.md b/CODE-AUDIT.md new file mode 100644 index 00000000..46db7c9c --- /dev/null +++ b/CODE-AUDIT.md @@ -0,0 +1,14 @@ +
+ +
+

Exploring the Scripts and Steps Involved in an Application LXC Installation

+ +1) [adguard.sh](https://github.com/tteck/Proxmox/blob/main/ct/adguard.sh): This script collects system parameters. (Also holds the function to update the application.) +2) [build.func](https://github.com/tteck/Proxmox/blob/main/misc/build.func): Adds user settings and integrates collected information. +3) [create_lxc.sh](https://github.com/tteck/Proxmox/blob/main/ct/create_lxc.sh): Constructs the LXC container. +4) [adguard-install.sh](https://github.com/tteck/Proxmox/blob/main/install/adguard-install.sh): Executes functions from [install.func](https://github.com/tteck/Proxmox/blob/main/misc/install.func), and installs the application. +5) [adguard.sh](https://github.com/tteck/Proxmox/blob/main/ct/adguard.sh) (again): To display the completion message. + +The installation process uses reusable scripts: [build.func](https://github.com/tteck/Proxmox/blob/main/misc/build.func), [create_lxc.sh](https://github.com/tteck/Proxmox/blob/main/ct/create_lxc.sh), and [install.func](https://github.com/tteck/Proxmox/blob/main/misc/install.func), which are not specific to any particular application. + +To gain a better understanding, focus on reviewing [adguard-install.sh](https://github.com/tteck/Proxmox/blob/main/install/adguard-install.sh). This script contains the commands and configurations for installing and configuring AdGuard Home within the LXC container. diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..86316b3f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021-2024 tteck + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..9401c778 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +
+ + + +
+

Proxmox VE Helper-Scripts

+ +

+ Website | + Contribute | + Guides | + Changelog | + Support +

+ +--- + +These scripts empower users to create a Linux container or virtual machine interactively, providing choices for both simple and advanced configurations. The basic setup adheres to default settings, while the advanced setup gives users the ability to customize these defaults. + +Options are displayed to users in a dialog box format. Once the user makes their selections, the script collects and validates their input to generate the final configuration for the container or virtual machine. +

+Be cautious and thoroughly evaluate scripts and automation tasks obtained from external sources. Read more +

+
Proxmox® is a registered trademark of Proxmox Server Solutions GmbH.
diff --git a/USER_SUBMITTED_GUIDES.md b/USER_SUBMITTED_GUIDES.md new file mode 100644 index 00000000..e3c8ffdd --- /dev/null +++ b/USER_SUBMITTED_GUIDES.md @@ -0,0 +1,40 @@ +
+ + + +
+

User Submitted Guides

+ + In order to contribute a guide on installing with Proxmox VE Helper Scripts, you should open a pull request that adds the guide to the `USER_SUBMITTED_GUIDES.md` file. + +[Proxmox Automation with Proxmox Helper Scripts!](https://www.youtube.com/watch?v=kcpu4z5eSEU) + +[Installing Home Assistant OS using Proxmox 8](https://community.home-assistant.io/t/installing-home-assistant-os-using-proxmox-8/201835) + +[How To Separate Zigbee2MQTT From Home Assistant In Proxmox](https://smarthomescene.com/guides/how-to-separate-zigbee2mqtt-from-home-assistant-in-proxmox/) + +[How To Install Home Assistant On Proxmox: The Easy Way](https://smarthomescene.com/guides/how-to-install-home-assistant-on-proxmox-the-easy-way/) + +[Home Assistant: Installing InfluxDB (LXC)](https://www.derekseaman.com/2023/04/home-assistant-installing-influxdb-lxc.html) + +[Home Assistant: Proxmox Quick Start Guide](https://www.derekseaman.com/2023/10/home-assistant-proxmox-ve-8-0-quick-start-guide-2.html) + +[Home Assistant: Installing Grafana (LXC) with Let’s Encrypt SSL](https://www.derekseaman.com/2023/04/home-assistant-installing-grafana-lxc.html) + +[Proxmox: Plex LXC with Alder Lake Transcoding](https://www.derekseaman.com/2023/04/proxmox-plex-lxc-with-alder-lake-transcoding.html) + +[How To Backup Home Assistant In Proxmox](https://smarthomescene.com/guides/how-to-backup-home-assistant-in-proxmox/) + +[Running Frigate on Proxmox](https://www.homeautomationguy.io/blog/running-frigate-on-proxmox) + +[Frigate VM on Proxmox with PCIe Coral TPU](https://www.derekseaman.com/2023/06/home-assistant-frigate-vm-on-proxmox-with-pcie-coral-tpu.html) + +[Moving Home Assistant’s Database To MariaDB On Proxmox](https://smarthomescene.com/guides/moving-home-assistants-database-to-mariadb-on-proxmox/) + +[How-to: Proxmox VE 7.4 to 8.0 Upgrade](https://www.derekseaman.com/2023/06/how-to-proxmox-7-4-to-8-0-upgrade.html) + +[iGPU Transcoding In Proxmox with Jellyfin](https://www.youtube.com/watch?v=XAa_qpNmzZs) + +[Proxmox + NetData]() + +[Proxmox Homelab Series]() diff --git a/ct/actualbudget.sh b/ct/actualbudget.sh new file mode 100644 index 00000000..1f1e201d --- /dev/null +++ b/ct/actualbudget.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___ __ __ ____ __ __ + / | _____/ /___ ______ _/ / / __ )__ ______/ /___ ____ / /_ + / /| |/ ___/ __/ / / / __ `/ / / __ / / / / __ / __ `/ _ \/ __/ + / ___ / /__/ /_/ /_/ / /_/ / / / /_/ / /_/ / /_/ / /_/ / __/ /_ +/_/ |_\___/\__/\__,_/\__,_/_/ /_____/\__,_/\__,_/\__, /\___/\__/ + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Actual Budget" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/actualbudget ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP}" +systemctl stop actualbudget.service +cd /opt/actualbudget +git pull &>/dev/null +yarn install &>/dev/null +systemctl start actualbudget.service +msg_ok "Successfully Updated ${APP}" +exit +} + +start +build_container +description +msg_info "Setting Container to Normal Resources" +pct set $CTID -memory 1024 +pct set $CTID -cores 1 +msg_ok "Set Container to Normal Resources" +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5006${CL} \n" diff --git a/ct/adguard.sh b/ct/adguard.sh new file mode 100644 index 00000000..b7a8fdd5 --- /dev/null +++ b/ct/adguard.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___ __ __ + / | ____/ /___ ___ ______ __________/ / + / /| |/ __ / __ / / / / __ / ___/ __ / + / ___ / /_/ / /_/ / /_/ / /_/ / / / /_/ / +/_/ |_\__,_/\__, /\__,_/\__,_/_/ \__,_/ + /____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Adguard" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/AdGuardHome ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +if (( $(df /boot | awk 'NR==2{gsub("%","",$5); print $5}') > 80 )); then + read -r -p "Warning: Storage is dangerously low, continue anyway? " prompt + [[ ${prompt,,} =~ ^(y|yes)$ ]] || exit +fi +wget -qL https://static.adguard.com/adguardhome/release/AdGuardHome_linux_amd64.tar.gz +msg_info "Stopping AdguardHome" +systemctl stop AdGuardHome +msg_ok "Stopped AdguardHome" + +msg_info "Updating AdguardHome" +tar -xvf AdGuardHome_linux_amd64.tar.gz &>/dev/null +mkdir -p adguard-backup +cp -r /opt/AdGuardHome/AdGuardHome.yaml /opt/AdGuardHome/data adguard-backup/ +cp AdGuardHome/AdGuardHome /opt/AdGuardHome/AdGuardHome +cp -r adguard-backup/* /opt/AdGuardHome/ +msg_ok "Updated AdguardHome" + +msg_info "Starting AdguardHome" +systemctl start AdGuardHome +msg_ok "Started AdguardHome" + +msg_info "Cleaning Up" +rm -rf AdGuardHome_linux_amd64.tar.gz AdGuardHome adguard-backup +msg_ok "Cleaned" +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/agentdvr.sh b/ct/agentdvr.sh new file mode 100644 index 00000000..d77921bf --- /dev/null +++ b/ct/agentdvr.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___ __ ____ _ ______ + / | ____ ____ ____ / /_/ __ \ | / / __ \ + / /| |/ __ `/ _ \/ __ \/ __/ / / / | / / /_/ / + / ___ / /_/ / __/ / / / /_/ /_/ /| |/ / _, _/ +/_/ |_\__, /\___/_/ /_/\__/_____/ |___/_/ |_| + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="AgentDVR" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="ubuntu" +var_version="22.04" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="0" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/agentdvr ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_error "There is currently no update path available." +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP}${CL} should be reachable by going to the following URL. + ${BL}http://${IP}:8090${CL} \n" diff --git a/ct/alpine-docker.sh b/ct/alpine-docker.sh new file mode 100644 index 00000000..6fe0c3bf --- /dev/null +++ b/ct/alpine-docker.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + ____ __ + / __ \____ _____/ /_ __ _____ + / / / / __ \/ ___/ //_/ _ \/ ___/ + / /_/ / /_/ / /__/ ,< / __/ / +/_____/\____/\___/_/|_|\___/_/ + Alpine + +EOF +} +header_info +echo -e "Loading..." +APP="Alpine-Docker" +var_disk="2" +var_cpu="1" +var_ram="1024" +var_os="alpine" +var_version="3.19" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + if ! apk -e info newt >/dev/null 2>&1; then + apk add -q newt + fi + while true; do + CHOICE=$( + whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --menu "Select option" 11 58 1 \ + "1" "Check for Docker Updates" 3>&2 2>&1 1>&3 + ) + exit_status=$? + if [ $exit_status == 1 ]; then + clear + exit-script + fi + header_info + case $CHOICE in + 1) + apk update && apk upgrade + exit + ;; + esac + done +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/alpine-grafana.sh b/ct/alpine-grafana.sh new file mode 100644 index 00000000..97e5ebde --- /dev/null +++ b/ct/alpine-grafana.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + ______ ____ + / ____/________ _/ __/___ _____ ____ _ + / / __/ ___/ __ / /_/ __ / __ \/ __ / +/ /_/ / / / /_/ / __/ /_/ / / / / /_/ / +\____/_/ \__,_/_/ \__,_/_/ /_/\__,_/ + Alpine + +EOF +} +header_info +echo -e "Loading..." +APP="Alpine-Grafana" +var_disk="1" +var_cpu="1" +var_ram="256" +var_os="alpine" +var_version="3.19" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + if ! apk -e info newt >/dev/null 2>&1; then + apk add -q newt + fi + LXCIP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1) + while true; do + CHOICE=$( + whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --menu "Select option" 11 58 3 \ + "1" "Check for Grafana Updates" \ + "2" "Allow 0.0.0.0 for listening" \ + "3" "Allow only ${LXCIP} for listening" 3>&2 2>&1 1>&3 + ) + exit_status=$? + if [ $exit_status == 1 ]; then + clear + exit-script + fi + header_info + case $CHOICE in + 1) + apk update && apk upgrade + exit + ;; + 2) + sed -i -e "s/cfg:server.http_addr=.*/cfg:server.http_addr=0.0.0.0/g" /etc/conf.d/grafana + service grafana restart + exit + ;; + 3) + sed -i -e "s/cfg:server.http_addr=.*/cfg:server.http_addr=$LXCIP/g" /etc/conf.d/grafana + service grafana restart + exit + ;; + esac + done +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/alpine-nextcloud.sh b/ct/alpine-nextcloud.sh new file mode 100644 index 00000000..c683cfe2 --- /dev/null +++ b/ct/alpine-nextcloud.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + _ __ __ __ __ __ __ __ + / | / /__ _ __/ /______/ /___ __ ______/ / / / / /_ __/ /_ + / |/ / _ \| |/_/ __/ ___/ / __ \/ / / / __ / / /_/ / / / / __ \ + / /| / __/> /dev/null 2>&1; then + apk add -q newt + fi + while true; do + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 3 \ + "1" "Nextcloud Login Credentials" ON \ + "2" "Renew Self-signed Certificate" OFF \ + 3>&1 1>&2 2>&3) + exit_status=$? + if [ $exit_status == 1 ]; then + clear + exit-script + fi + header_info + case $CHOICE in + 1) + cat nextcloud.creds + exit + ;; + 2) + openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout /etc/ssl/private/nextcloud-selfsigned.key -out /etc/ssl/certs/nextcloud-selfsigned.crt -subj "/C=US/O=Nextcloud/OU=Domain Control Validated/CN=nextcloud.local" > /dev/null 2>&1 + rc-service nginx restart + exit + ;; + esac + done +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}https://${IP}${CL} \n" diff --git a/ct/alpine-vaultwarden.sh b/ct/alpine-vaultwarden.sh new file mode 100644 index 00000000..23bb5f26 --- /dev/null +++ b/ct/alpine-vaultwarden.sh @@ -0,0 +1,102 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + _ __ ____ __ +| | / /___ ___ __/ / /__ ______ __________/ /__ ____ +| | / / __ `/ / / / / __/ | /| / / __ `/ ___/ __ / _ \/ __ \ +| |/ / /_/ / /_/ / / /_ | |/ |/ / /_/ / / / /_/ / __/ / / / +|___/\__,_/\__,_/_/\__/ |__/|__/\__,_/_/ \__,_/\___/_/ /_/ + Alpine + +EOF +} +header_info +echo -e "Loading..." +APP="Alpine-Vaultwarden" +var_disk="0.3" +var_cpu="1" +var_ram="256" +var_os="alpine" +var_version="3.19" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + if ! apk -e info newt >/dev/null 2>&1; then + apk add -q newt + fi + while true; do + CHOICE=$( + whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --menu "Select option" 11 58 2 \ + "1" "Update Vaultwarden" \ + "2" "Reset ADMIN_TOKEN" 3>&2 2>&1 1>&3 + ) + exit_status=$? + if [ $exit_status == 1 ]; then + clear + exit-script + fi + header_info + case $CHOICE in + 1) + apk update && apk upgrade + exit + ;; + 2) + if NEWTOKEN=$(whiptail --backtitle "Proxmox VE Helper Scripts" --passwordbox "Setup your ADMIN_TOKEN (make it strong)" 10 58 3>&1 1>&2 2>&3); then + if [[ -z "$NEWTOKEN" ]]; then exit-script; fi + if ! command -v argon2 >/dev/null 2>&1; then apk add argon2 &>/dev/null; fi + TOKEN=$(echo -n ${NEWTOKEN} | argon2 "$(openssl rand -base64 32)" -e -id -k 19456 -t 2 -p 1) + if [[ ! -f /var/lib/vaultwarden/config.json ]]; then + sed -i "s|export ADMIN_TOKEN=.*|export ADMIN_TOKEN='${TOKEN}'|" /etc/conf.d/vaultwarden + else + sed -i "s|\"admin_token\": .*|\"admin_token\": \"${TOKEN}\",|" /var/lib/vaultwarden/config.json + fi + rc-service vaultwarden restart -q + fi + clear + exit + ;; + esac + done +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8000${CL} \n" diff --git a/ct/alpine-zigbee2mqtt.sh b/ct/alpine-zigbee2mqtt.sh new file mode 100644 index 00000000..eb98903a --- /dev/null +++ b/ct/alpine-zigbee2mqtt.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + _____ _ __ ___ __ _______ ____________ +/__ / (_)___ _/ /_ ___ ___ |__ \ / |/ / __ \/_ __/_ __/ + / / / / __ / __ \/ _ \/ _ \__/ // /|_/ / / / / / / / / + / /__/ / /_/ / /_/ / __/ __/ __// / / / /_/ / / / / / +/____/_/\__, /_.___/\___/\___/____/_/ /_/\___\_\/_/ /_/ + /____/ Alpine + +EOF +} +header_info +echo -e "Loading..." +APP="Alpine-Zigbee2MQTT" +var_disk="0.3" +var_cpu="1" +var_ram="256" +var_os="alpine" +var_version="3.19" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="0" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + if ! apk -e info newt >/dev/null 2>&1; then + apk add -q newt + fi + while true; do + CHOICE=$( + whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --menu "Select option" 11 58 1 \ + "1" "Check for Zigbee2MQTT Updates" 3>&2 2>&1 1>&3 + ) + exit_status=$? + if [ $exit_status == 1 ]; then + clear + exit-script + fi + header_info + case $CHOICE in + 1) + apk update && apk upgrade + exit + ;; + esac + done +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/alpine.sh b/ct/alpine.sh new file mode 100644 index 00000000..8a651555 --- /dev/null +++ b/ct/alpine.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___ __ _ + / | / /___ (_)___ ___ + / /| | / / __ \/ / __ \/ _ \ + / ___ |/ / /_/ / / / / / __/ +/_/ |_/_/ .___/_/_/ /_/\___/ + /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Alpine" +var_disk="0.1" +var_cpu="1" +var_ram="512" +var_os="alpine" +var_version="3.19" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="-password alpine" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 1 \ + "1" "Check for Alpine Updates" ON \ + 3>&1 1>&2 2>&3) + +header_info +if [ "$UPD" == "1" ]; then +apk update && apk upgrade +exit; +fi +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/apache-cassandra.sh b/ct/apache-cassandra.sh new file mode 100644 index 00000000..35f83dff --- /dev/null +++ b/ct/apache-cassandra.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___ __ ______ __ + / | ____ ____ ______/ /_ ___ / ____/___ _______________ _____ ____/ /________ _ + / /| | / __ \/ __ `/ ___/ __ \/ _ \ / / / __ `/ ___/ ___/ __ `/ __ \/ __ / ___/ __ `/ + / ___ |/ /_/ / /_/ / /__/ / / / __/ / /___/ /_/ (__ |__ ) /_/ / / / / /_/ / / / /_/ / +/_/ |_/ .___/\__,_/\___/_/ /_/\___/ \____/\__,_/____/____/\__,_/_/ /_/\__,_/_/ \__,_/ + /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Apache-Cassandra" +var_disk="4" +var_cpu="1" +var_ram="2048" +var_os="debian" +var_version="12" +VERBOSE="yes" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/cassandra.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_error "There is currently no update path available." +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/apache-couchdb.sh b/ct/apache-couchdb.sh new file mode 100644 index 00000000..cd2c00af --- /dev/null +++ b/ct/apache-couchdb.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___ __ ______ __ ____ ____ + / | ____ ____ ______/ /_ ___ / ____/___ __ _______/ /_ / __ \/ __ ) + / /| | / __ \/ __ `/ ___/ __ \/ _ \ / / / __ \/ / / / ___/ __ \/ / / / __ | + / ___ |/ /_/ / /_/ / /__/ / / / __/ / /___/ /_/ / /_/ / /__/ / / / /_/ / /_/ / +/_/ |_/ .___/\__,_/\___/_/ /_/\___/ \____/\____/\__,_/\___/_/ /_/_____/_____/ + /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Apache-CouchDB" +var_disk="10" +var_cpu="2" +var_ram="4096" +var_os="debian" +var_version="12" +VERBOSE="yes" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/couchdb.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_error "There is currently no update path available." +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5984/_utils/${CL} \n" diff --git a/ct/apt-cacher-ng.sh b/ct/apt-cacher-ng.sh new file mode 100644 index 00000000..8d8235a3 --- /dev/null +++ b/ct/apt-cacher-ng.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___ __ ______ __ _ ________ + / | ____ / /_ / ____/___ ______/ /_ ___ _____ / | / / ____/ + / /| | / __ \/ __/__/ / / __ `/ ___/ __ \/ _ \/ ___/__/ |/ / / __ + / ___ |/ /_/ / /_/__/ /___/ /_/ / /__/ / / / __/ / /__/ /| / /_/ / +/_/ |_/ .___/\__/ \____/\__,_/\___/_/ /_/\___/_/ /_/ |_/\____/ + /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Apt-Cacher-NG" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} maintenance page should be reachable by going to the following URL. + ${BL}http://${IP}:3142/acng-report.html${CL} \n" diff --git a/ct/aria2.sh b/ct/aria2.sh new file mode 100644 index 00000000..7fc96b97 --- /dev/null +++ b/ct/aria2.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___ _ ___ + / | _____(_)___ |__ \ + / /| | / ___/ / __ `/_/ / + / ___ |/ / / / /_/ / __/ +/_/ |_/_/ /_/\__,_/____/ +EOF +} +header_info +echo -e "Loading..." +APP="Aria2" +var_disk="8" +var_cpu="2" +var_ram="1028" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:6880${CL}" diff --git a/ct/audiobookshelf.sh b/ct/audiobookshelf.sh new file mode 100644 index 00000000..4d360634 --- /dev/null +++ b/ct/audiobookshelf.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___ __ __ __ ______ + ____ ___ ______/ (_)___ / /_ ____ ____ / /_______/ /_ ___ / / __/ + / __ `/ / / / __ / / __ \/ __ \/ __ \/ __ \/ //_/ ___/ __ \/ _ \/ / /_ +/ /_/ / /_/ / /_/ / / /_/ / /_/ / /_/ / /_/ / ,< (__ ) / / / __/ / __/ +\__,_/\__,_/\__,_/_/\____/_.___/\____/\____/_/|_/____/_/ /_/\___/_/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="audiobookshelf" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/apt/trusted.gpg.d/audiobookshelf-ppa.asc ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +echo "This application receives updates through the APT package manager." +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:13378${CL} \n" diff --git a/ct/autobrr.sh b/ct/autobrr.sh new file mode 100644 index 00000000..8cfc2f3e --- /dev/null +++ b/ct/autobrr.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___ __ __ + / | __ __/ /_____ / /_ __________ + / /| |/ / / / __/ __ \/ __ \/ ___/ ___/ + / ___ / /_/ / /_/ /_/ / /_/ / / / / +/_/ |_\__,_/\__/\____/_.___/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Autobrr" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /root/.config/autobrr/config.toml ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Stopping ${APP} LXC" +systemctl stop autobrr.service +msg_ok "Stopped ${APP} LXC" + +msg_info "Updating ${APP} LXC" +rm -rf /usr/local/bin/* +wget -q $(curl -s https://api.github.com/repos/autobrr/autobrr/releases/latest | grep download | grep linux_x86_64 | cut -d\" -f4) +tar -C /usr/local/bin -xzf autobrr*.tar.gz +rm -rf autobrr*.tar.gz +msg_ok "Updated ${APP} LXC" + +msg_info "Starting ${APP} LXC" +systemctl start autobrr.service +msg_ok "Started ${APP} LXC" +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:7474${CL} \n" diff --git a/ct/bazarr.sh b/ct/bazarr.sh new file mode 100755 index 00000000..d94543e5 --- /dev/null +++ b/ct/bazarr.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ + / __ )____ _____ ____ ___________ + / __ / __ `/_ / / __ `/ ___/ ___/ + / /_/ / /_/ / / /_/ /_/ / / / / +/_____/\__,_/ /___/\__,_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Bazarr" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var/lib/bazarr/ ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:6767${CL} \n" diff --git a/ct/blocky.sh b/ct/blocky.sh new file mode 100644 index 00000000..a9c74c4d --- /dev/null +++ b/ct/blocky.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ __ + / __ )/ /___ _____/ /____ __ + / __ / / __ \/ ___/ //_/ / / / + / /_/ / / /_/ / /__/ ,< / /_/ / +/_____/_/\____/\___/_/|_|\__, / + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Blocky" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/bunkerweb.sh b/ct/bunkerweb.sh new file mode 100644 index 00000000..14e8a2a6 --- /dev/null +++ b/ct/bunkerweb.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ _ __ __ + / __ )__ ______ / /_____ ____| | / /__ / /_ + / __ / / / / __ \/ //_/ _ \/ ___/ | /| / / _ \/ __ \ + / /_/ / /_/ / / / / ,< / __/ / | |/ |/ / __/ /_/ / +/_____/\__,_/_/ /_/_/|_|\___/_/ |__/|__/\___/_.___/ + +EOF +} +header_info +echo -e "Loading..." +APP="BunkerWeb" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /etc/bunkerweb ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + +RELEASE=$(curl -s https://api.github.com/repos/bunkerity/bunkerweb/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + + msg_info "Updating ${APP} to ${RELEASE}" + cat </etc/apt/preferences.d/bunkerweb +Package: bunkerweb +Pin: version ${RELEASE} +Pin-Priority: 1001 +EOF + apt-get update + apt-get install nginx -y + apt-get install -y bunkerweb=${RELEASE} + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated ${APP} to ${RELEASE}" + +else + msg_ok "No update required. ${APP} is already at ${RELEASE}" +fi +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} setup should be reachable by going to the following URL. + ${BL}http://${IP}/setup${CL} \n" diff --git a/ct/caddy.sh b/ct/caddy.sh new file mode 100644 index 00000000..6df98d39 --- /dev/null +++ b/ct/caddy.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ __ __ + / ____/___ _____/ /___/ /_ __ + / / / __ `/ __ / __ / / / / +/ /___/ /_/ / /_/ / /_/ / /_/ / +\____/\__,_/\__,_/\__,_/\__, / + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Caddy" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /etc/caddy ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/calibre-web.sh b/ct/calibre-web.sh new file mode 100644 index 00000000..5cf87184 --- /dev/null +++ b/ct/calibre-web.sh @@ -0,0 +1,164 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: remz1337 +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ ___ __ _ __ __ + / ____/___ _/ (_) /_ ________ | | / /__ / /_ + / / / __ `/ / / __ \/ ___/ _ \___| | /| / / _ \/ __ \ +/ /___/ /_/ / / / /_/ / / / __/___/ |/ |/ / __/ /_/ / +\____/\__,_/_/_/_.___/_/ \___/ |__/|__/\___/_.___/ + +EOF +} +header_info +echo -e "Loading..." +APP="Calibre-Web" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + if [[ ! -f /etc/systemd/system/cps.service ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + header_info + msg_info "Updating $APP LXC" + systemctl stop cps + cd /opt/kepubify + rm kepubify-linux-64bit + curl -fsSLO https://github.com/pgaskin/kepubify/releases/latest/download/kepubify-linux-64bit &>/dev/null + chmod +x kepubify-linux-64bit + menu_array=("1" "Enables gdrive as storage backend for your ebooks" OFF \ + "2" "Enables sending emails via a googlemail account without enabling insecure apps" OFF \ + "3" "Enables displaying of additional author infos on the authors page" OFF \ + "4" "Enables login via LDAP server" OFF \ + "5" "Enables login via google or github oauth" OFF \ + "6" "Enables extracting of metadata from epub, fb2, pdf files, and also extraction of covers from cbr, cbz, cbt files" OFF \ + "7" "Enables extracting of metadata from cbr, cbz, cbt files" OFF \ + "8" "Enables syncing with your kobo reader" OFF ) + if [ -f "/opt/calibre-web/options.txt" ]; then + cps_options="$(cat /opt/calibre-web/options.txt)" + IFS=',' read -ra ADDR <<< "$cps_options" + for i in "${ADDR[@]}"; do + if [ $i == "gdrive" ]; then + line=0 + elif [ $i == "gmail" ]; then + line=1 + elif [ $i == "goodreads" ]; then + line=2 + elif [ $i == "ldap" ]; then + line=3 + elif [ $i == "oauth" ]; then + line=4 + elif [ $i == "metadata" ]; then + line=5 + elif [ $i == "comics" ]; then + line=6 + elif [ $i == "kobo" ]; then + line=7 + fi + array_index=$(( 3*line + 2 )) + menu_array[$array_index]=ON + done + fi + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + CHOICES=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CALIBRE-WEB OPTIONS" --separate-output --checklist "Choose Additional Options" 15 125 8 "${menu_array[@]}" 3>&1 1>&2 2>&3) + spinner & + SPINNER_PID=$! + if [ ! -z "$CHOICES" ]; then + declare -a options + for CHOICE in $CHOICES; do + case "$CHOICE" in + "1") + options+=( gdrive ) + ;; + "2") + options+=( gmail ) + ;; + "3") + options+=( goodreads ) + ;; + "4") + options+=( ldap ) + apt-get install -qqy libldap2-dev libsasl2-dev + ;; + "5") + options+=( oauth ) + ;; + "6") + options+=( metadata ) + ;; + "7") + options+=( comics ) + ;; + "8") + options+=( kobo ) + ;; + *) + echo "Unsupported item $CHOICE!" >&2 + exit 1 + ;; + esac + done + fi + if [ ! -z "$options" ] && [ ${#options[@]} -gt 0 ]; then + cps_options=$(IFS=, ; echo "${options[*]}") + echo $cps_options > /opt/calibre-web/options.txt + pip install --upgrade calibreweb[$cps_options] + else + rm /opt/calibre-web/options.txt 2> /dev/null + pip install --upgrade calibreweb + fi + systemctl start cps + msg_ok "Updated $APP LXC" + exit +} + +start +build_container +description + +msg_info "Setting Container to Normal Resources" +pct set $CTID -memory 512 +pct set $CTID -cores 1 +msg_ok "Set Container to Normal Resources" +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8083${CL} \n" diff --git a/ct/casaos.sh b/ct/casaos.sh new file mode 100644 index 00000000..85cc0510 --- /dev/null +++ b/ct/casaos.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ ____ _____ + / ____/___ __________ _/ __ \/ ___/ + / / / __ `/ ___/ __ `/ / / /\__ \ +/ /___/ /_/ (__ ) /_/ / /_/ /___/ / +\____/\__,_/____/\__,_/\____//____/ + +EOF +} +header_info +echo -e "Loading..." +APP="CasaOS" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated ${APP} LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP} ${CL} \n" diff --git a/ct/changedetection.sh b/ct/changedetection.sh new file mode 100644 index 00000000..b6f42369 --- /dev/null +++ b/ct/changedetection.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ________ ____ __ __ _ + / ____/ /_ ____ _____ ____ ____ / __ \___ / /____ _____/ /_(_)___ ____ + / / / __ \/ __ `/ __ \/ __ `/ _ \ / / / / _ \/ __/ _ \/ ___/ __/ / __ \/ __ \ +/ /___/ / / / /_/ / / / / /_/ / __/ / /_/ / __/ /_/ __/ /__/ /_/ / /_/ / / / / +\____/_/ /_/\__,_/_/ /_/\__, /\___/ /_____/\___/\__/\___/\___/\__/_/\____/_/ /_/ + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Change Detection" +var_disk="8" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/changedetection.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +if ! dpkg -s libjpeg-dev >/dev/null 2>&1; then + apt-get update + apt-get install -y libjpeg-dev +fi +pip3 install changedetection.io --upgrade &>/dev/null +pip3 install playwright --upgrade &>/dev/null +systemctl restart changedetection +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5000${CL} \n" diff --git a/ct/channels.sh b/ct/channels.sh new file mode 100644 index 00000000..7e8b0140 --- /dev/null +++ b/ct/channels.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ________ __ ____ _ ______ _____ + / ____/ /_ ____ _____ ____ ___ / /____ / __ \ | / / __ \ / ___/___ ______ _____ _____ + / / / __ \/ __ `/ __ \/ __ \/ _ \/ / ___/ / / / / | / / /_/ / \__ \/ _ \/ ___/ | / / _ \/ ___/ +/ /___/ / / / /_/ / / / / / / / __/ (__ ) / /_/ /| |/ / _, _/ ___/ / __/ / | |/ / __/ / +\____/_/ /_/\__,_/_/ /_/_/ /_/\___/_/____/ /_____/ |___/_/ |_| /____/\___/_/ |___/\___/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Channels" +var_disk="8" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="0" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/channels-dvr ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_error "There is currently no update path available." +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:8089 ${CL} \n" diff --git a/ct/cloudflared.sh b/ct/cloudflared.sh new file mode 100644 index 00000000..c4f9631c --- /dev/null +++ b/ct/cloudflared.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ________ ________ __ + / ____/ /___ __ ______/ / __/ /___ _________ ____/ / + / / / / __ \/ / / / __ / /_/ / __ `/ ___/ _ \/ __ / +/ /___/ / /_/ / /_/ / /_/ / __/ / /_/ / / / __/ /_/ / +\____/_/\____/\__,_/\__,_/_/ /_/\__,_/_/ \___/\__,_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Cloudflared" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/commafeed.sh b/ct/commafeed.sh new file mode 100644 index 00000000..c5eeecad --- /dev/null +++ b/ct/commafeed.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ ______ __ + / ____/___ ____ ___ ____ ___ ____ _/ ____/__ ___ ____/ / + / / / __ \/ __ `__ \/ __ `__ \/ __ `/ /_ / _ \/ _ \/ __ / +/ /___/ /_/ / / / / / / / / / / / /_/ / __/ / __/ __/ /_/ / +\____/\____/_/ /_/ /_/_/ /_/ /_/\__,_/_/ \___/\___/\__,_/ + +EOF +} +header_info +echo -e "Loading..." +APP="CommaFeed" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/commafeed ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Stopping CommaFeed" +systemctl stop commafeed +msg_ok "Stopped CommaFeed" + +msg_info "Updating CommaFeed" +cd /opt/commafeed +rm commafeed.jar +wget -q https://github.com/Athou/commafeed/releases/latest/download/commafeed.jar +msg_ok "Updated CommaFeed" + +msg_info "Starting CommaFeed" +systemctl start commafeed +msg_ok "Update Completed Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8082${CL} \n" diff --git a/ct/create_lxc.sh b/ct/create_lxc.sh new file mode 100644 index 00000000..f5218600 --- /dev/null +++ b/ct/create_lxc.sh @@ -0,0 +1,183 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +# This sets verbose mode if the global variable is set to "yes" +# if [ "$VERBOSE" == "yes" ]; then set -x; fi + +# This function sets color variables for formatting output in the terminal +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +RD=$(echo "\033[01;31m") +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" +BFR="\\r\\033[K" +HOLD=" " + +# This sets error handling options and defines the error_handler function to handle errors +set -Eeuo pipefail +trap 'error_handler $LINENO "$BASH_COMMAND"' ERR + +# This function handles errors +function error_handler() { + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + printf "\e[?25h" + local exit_code="$?" + local line_number="$1" + local command="$2" + local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" + echo -e "\n$error_message\n" +} + +# This function displays a spinner. +function spinner() { + local chars="/-\|" + local spin_i=0 + printf "\e[?25l" + while true; do + printf "\r \e[36m%s\e[0m" "${chars:spin_i++%${#chars}:1}" + sleep 0.1 + done +} + +# This function displays an informational message with a yellow color. +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg} " + spinner & + SPINNER_PID=$! +} + +# This function displays a success message with a green color. +function msg_ok() { + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + printf "\e[?25h" + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +# This function displays a error message with a red color. +function msg_error() { + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + printf "\e[?25h" + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +# This checks for the presence of valid Container Storage and Template Storage locations +msg_info "Validating Storage" +VALIDCT=$(pvesm status -content rootdir | awk 'NR>1') +if [ -z "$VALIDCT" ]; then + msg_error "Unable to detect a valid Container Storage location." + exit 1 +fi +VALIDTMP=$(pvesm status -content vztmpl | awk 'NR>1') +if [ -z "$VALIDTMP" ]; then + msg_error "Unable to detect a valid Template Storage location." + exit 1 +fi + +# This function is used to select the storage class and determine the corresponding storage content type and label. +function select_storage() { + local CLASS=$1 + local CONTENT + local CONTENT_LABEL + case $CLASS in + container) + CONTENT='rootdir' + CONTENT_LABEL='Container' + ;; + template) + CONTENT='vztmpl' + CONTENT_LABEL='Container template' + ;; + *) false || exit "Invalid storage class." ;; + esac + + # This Queries all storage locations + local -a MENU + while read -r line; do + local TAG=$(echo $line | awk '{print $1}') + local TYPE=$(echo $line | awk '{printf "%-10s", $2}') + local FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') + local ITEM=" Type: $TYPE Free: $FREE " + local OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + local MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + MENU+=("$TAG" "$ITEM" "OFF") + done < <(pvesm status -content $CONTENT | awk 'NR>1') + + # Select storage location + if [ $((${#MENU[@]}/3)) -eq 1 ]; then + printf ${MENU[0]} + else + local STORAGE + while [ -z "${STORAGE:+x}" ]; do + STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \ + "Which storage pool you would like to use for the ${CONTENT_LABEL,,}?\nTo make a selection, use the Spacebar.\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${MENU[@]}" 3>&1 1>&2 2>&3) || exit "Menu aborted." + done + printf $STORAGE + fi +} + +# Test if required variables are set +[[ "${CTID:-}" ]] || exit "You need to set 'CTID' variable." +[[ "${PCT_OSTYPE:-}" ]] || exit "You need to set 'PCT_OSTYPE' variable." + +# Test if ID is valid +[ "$CTID" -ge "100" ] || exit "ID cannot be less than 100." + +# Test if ID is in use +if pct status $CTID &>/dev/null; then + echo -e "ID '$CTID' is already in use." + unset CTID + exit "Cannot use ID that is already in use." +fi + +# Get template storage +TEMPLATE_STORAGE=$(select_storage template) || exit +msg_ok "Using ${BL}$TEMPLATE_STORAGE${CL} ${GN}for Template Storage." + +# Get container storage +CONTAINER_STORAGE=$(select_storage container) || exit +msg_ok "Using ${BL}$CONTAINER_STORAGE${CL} ${GN}for Container Storage." + +# Update LXC template list +msg_info "Updating LXC Template List" +pveam update >/dev/null +msg_ok "Updated LXC Template List" + +# Get LXC template string +TEMPLATE_SEARCH=${PCT_OSTYPE}-${PCT_OSVERSION:-} +mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($TEMPLATE_SEARCH.*\)/\1/p" | sort -t - -k 2 -V) +[ ${#TEMPLATES[@]} -gt 0 ] || exit "Unable to find a template when searching for '$TEMPLATE_SEARCH'." +TEMPLATE="${TEMPLATES[-1]}" + +# Download LXC template if needed +if ! pveam list $TEMPLATE_STORAGE | grep -q $TEMPLATE; then + msg_info "Downloading LXC Template" + pveam download $TEMPLATE_STORAGE $TEMPLATE >/dev/null || + exit "A problem occured while downloading the LXC template." + msg_ok "Downloaded LXC Template" +fi + +# Combine all options +DEFAULT_PCT_OPTIONS=( + -arch $(dpkg --print-architecture)) + +PCT_OPTIONS=(${PCT_OPTIONS[@]:-${DEFAULT_PCT_OPTIONS[@]}}) +[[ " ${PCT_OPTIONS[@]} " =~ " -rootfs " ]] || PCT_OPTIONS+=(-rootfs $CONTAINER_STORAGE:${PCT_DISK_SIZE:-8}) + +# Create container +msg_info "Creating LXC Container" +pct create $CTID ${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE} ${PCT_OPTIONS[@]} >/dev/null || + exit "A problem occured while trying to create container." +msg_ok "LXC Container ${BL}$CTID${CL} ${GN}was successfully created." diff --git a/ct/cronicle.sh b/ct/cronicle.sh new file mode 100644 index 00000000..946101f3 --- /dev/null +++ b/ct/cronicle.sh @@ -0,0 +1,130 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ _ __ + / ____/________ ____ (_)____/ /__ + / / / ___/ __ \/ __ \/ / ___/ / _ \ +/ /___/ / / /_/ / / / / / /__/ / __/ +\____/_/ \____/_/ /_/_/\___/_/\___/ + +EOF +} +header_info +echo -e "Loading..." +APP="Cronicle" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 2 \ + "1" "Update ${APP}" ON \ + "2" "Install ${APP} Worker" OFF \ + 3>&1 1>&2 2>&3) + +if [ "$UPD" == "1" ]; then +header_info +if [[ ! -d /opt/cronicle ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + if [[ "$(node -v | cut -d 'v' -f 2)" == "18."* ]]; then + if ! command -v npm >/dev/null 2>&1; then + echo "Installing NPM..." + apt-get install -y npm >/dev/null 2>&1 + echo "Installed NPM..." + fi + fi +msg_info "Updating ${APP}" +/opt/cronicle/bin/control.sh upgrade &>/dev/null +msg_ok "Updated ${APP}" +exit +fi +if [ "$UPD" == "2" ]; then + if [[ "$(node -v | cut -d 'v' -f 2)" == "18."* ]]; then + if ! command -v npm >/dev/null 2>&1; then + echo "Installing NPM..." + apt-get install -y npm >/dev/null 2>&1 + echo "Installed NPM..." + fi + fi +LATEST=$(curl -sL https://api.github.com/repos/jhuckaby/Cronicle/releases/latest | grep '"tag_name":' | cut -d'"' -f4) +IP=$(hostname -I | awk '{print $1}') +msg_info "Installing Dependencies" + +apt-get install -y git &>/dev/null +apt-get install -y make &>/dev/null +apt-get install -y g++ &>/dev/null +apt-get install -y gcc &>/dev/null +apt-get install -y ca-certificates &>/dev/null +apt-get install -y gnupg &>/dev/null +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +apt-get update &>/dev/null +apt-get install -y nodejs &>/dev/null +msg_ok "Installed Node.js" + +msg_info "Installing Cronicle Worker" +mkdir -p /opt/cronicle +cd /opt/cronicle +tar zxvf <(curl -fsSL https://github.com/jhuckaby/Cronicle/archive/${LATEST}.tar.gz) --strip-components 1 &>/dev/null +npm install &>/dev/null +node bin/build.js dist &>/dev/null +sed -i "s/localhost:3012/${IP}:3012/g" /opt/cronicle/conf/config.json +/opt/cronicle/bin/control.sh start &>/dev/null +cp /opt/cronicle/bin/cronicled.init /etc/init.d/cronicled &>/dev/null +chmod 775 /etc/init.d/cronicled +update-rc.d cronicled defaults &>/dev/null +msg_ok "Installed Cronicle Worker" +echo -e "\n Add Masters secret key to /opt/cronicle/conf/config.json \n" +exit +fi +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Primary should be reachable by going to the following URL. + ${BL}http://${IP}:3012${CL} \n" diff --git a/ct/daemonsync.sh b/ct/daemonsync.sh new file mode 100644 index 00000000..01ffa4a7 --- /dev/null +++ b/ct/daemonsync.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ _____ + / __ \____ ____ ____ ___ ____ ____ / ___/__ ______ _____ + / / / / __ / _ \/ __ __ \/ __ \/ __ \ \__ \/ / / / __ \/ ___/ + / /_/ / /_/ / __/ / / / / / /_/ / / / / ___/ / /_/ / / / / /__ +/_____/\__,_/\___/_/ /_/ /_/\____/_/ /_/ /____/\__, /_/ /_/\___/ + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Daemon Sync" +var_disk="8" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8084${CL} \n" diff --git a/ct/dashy.sh b/ct/dashy.sh new file mode 100644 index 00000000..60ea57db --- /dev/null +++ b/ct/dashy.sh @@ -0,0 +1,109 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ + / __ \____ ______/ /_ __ __ + / / / / __ / ___/ __ \/ / / / + / /_/ / /_/ (__ ) / / / /_/ / +/_____/\__,_/____/_/ /_/\__, / + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Dashy" +var_disk="6" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/dashy/public/ ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + +RELEASE=$(curl -sL https://api.github.com/repos/Lissy93/dashy/releases/latest | grep '"tag_name":' | cut -d'"' -f4) +if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Stopping ${APP}" + systemctl stop dashy + msg_ok "Stopped ${APP}" + + msg_info "Backing up conf.yml" + cd ~ + if [[ -f /opt/dashy/public/conf.yml ]]; then + cp -R /opt/dashy/public/conf.yml conf.yml + else + cp -R /opt/dashy/user-data/conf.yml conf.yml + fi + msg_ok "Backed up conf.yml" + + msg_info "Updating ${APP} to ${RELEASE}" + rm -rf /opt/dashy + mkdir -p /opt/dashy + wget -qO- https://github.com/Lissy93/dashy/archive/refs/tags/${RELEASE}.tar.gz | tar -xz -C /opt/dashy --strip-components=1 + cd /opt/dashy + npm install &>/dev/null + npm run build &>/dev/null + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated ${APP} to ${RELEASE}" + + msg_info "Restoring conf.yml" + cd ~ + cp -R conf.yml /opt/dashy/user-data + msg_ok "Restored conf.yml" + + msg_info "Cleaning" + rm -rf conf.yml /opt/dashy/public/conf.yml + msg_ok "Cleaned" + + msg_info "Starting Dashy" + systemctl start dashy + msg_ok "Started Dashy" + msg_ok "Updated Successfully" +else + msg_ok "No update required. ${APP} is already at ${RELEASE}" +fi +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:4000${CL} \n" diff --git a/ct/debian.sh b/ct/debian.sh new file mode 100644 index 00000000..2472b0ac --- /dev/null +++ b/ct/debian.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ _ + / __ \___ / /_ (_)___ ____ + / / / / _ \/ __ \/ / __ `/ __ \ + / /_/ / __/ /_/ / / /_/ / / / / +/_____/\___/_.___/_/\__,_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Debian" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/deconz.sh b/ct/deconz.sh new file mode 100644 index 00000000..bf42af0c --- /dev/null +++ b/ct/deconz.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __________ _ _______ + ____/ /__ / ____/ __ \/ | / /__ / + / __ / _ \/ / / / / / |/ / / / +/ /_/ / __/ /___/ /_/ / /| / / /__ +\__,_/\___/\____/\____/_/ |_/ /____/ + +EOF +} +header_info +echo -e "Loading..." +APP="deCONZ" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="0" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/apt/sources.list.d/deconz.list ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}${CL}\n" diff --git a/ct/deluge.sh b/ct/deluge.sh new file mode 100644 index 00000000..897a3bf8 --- /dev/null +++ b/ct/deluge.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ + / __ \___ / /_ ______ ____ + / / / / _ \/ / / / / __ `/ _ \ + / /_/ / __/ / /_/ / /_/ / __/ +/_____/\___/_/\__,_/\__, /\___/ + /____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Deluge" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/deluged.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +pip3 install deluge[all] --upgrade +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8112${CL} \n" diff --git a/ct/docker.sh b/ct/docker.sh new file mode 100644 index 00000000..ce263f9b --- /dev/null +++ b/ct/docker.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ + / __ \____ _____/ /_ __ _____ + / / / / __ \/ ___/ //_/ _ \/ ___/ + / /_/ / /_/ / /__/ ,< / __/ / +/_____/\____/\___/_/|_|\___/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Docker" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated ${APP} LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/dockge.sh b/ct/dockge.sh new file mode 100644 index 00000000..b1d943a4 --- /dev/null +++ b/ct/dockge.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ + / __ \____ _____/ /______ ____ + / / / / __ \/ ___/ //_/ __ `/ _ \ + / /_/ / /_/ / /__/ ,< / /_/ / __/ +/_____/\____/\___/_/|_|\__, /\___/ + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Dockge" +var_disk="18" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/dockge ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP}" +cd /opt/dockge +docker compose pull +docker compose up -d +msg_ok "Updated ${APP}" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5001${CL} \n" diff --git a/ct/emby.sh b/ct/emby.sh new file mode 100644 index 00000000..092a44a4 --- /dev/null +++ b/ct/emby.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ __ + / ____/___ ___ / /_ __ __ + / __/ / __ __ \/ __ \/ / / / + / /___/ / / / / / /_/ / /_/ / +/_____/_/ /_/ /_/_.___/\__, / + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Emby" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="ubuntu" +var_version="22.04" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/emby-server ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +LATEST=$(curl -sL https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | grep '"tag_name":' | cut -d'"' -f4) +msg_info "Stopping ${APP}" +systemctl stop emby-server +msg_ok "Stopped ${APP}" + +msg_info "Updating ${APP}" +wget https://github.com/MediaBrowser/Emby.Releases/releases/download/${LATEST}/emby-server-deb_${LATEST}_amd64.deb &>/dev/null +dpkg -i emby-server-deb_${LATEST}_amd64.deb &>/dev/null +rm emby-server-deb_${LATEST}_amd64.deb +msg_ok "Updated ${APP}" + +msg_info "Starting ${APP}" +systemctl start emby-server +msg_ok "Started ${APP}" +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8096${CL}\n" diff --git a/ct/emqx.sh b/ct/emqx.sh new file mode 100644 index 00000000..6ec3cab7 --- /dev/null +++ b/ct/emqx.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ________ _______ _ __ + / ____/ |/ / __ \ | |/ / + / __/ / /|_/ / / / / | / + / /___/ / / / /_/ / / | +/_____/_/ /_/\___\_\/_/|_| + +EOF +} +header_info +echo -e "Loading..." +APP="EMQX" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:18083${CL} \n" diff --git a/ct/ersatztv.sh b/ct/ersatztv.sh new file mode 100644 index 00000000..81ea5b7b --- /dev/null +++ b/ct/ersatztv.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +# Source: https://github.com/ErsatzTV/ErsatzTV/ + + +function header_info { +clear +cat <<"EOF" + ______ __ _______ __ + / ____/_____________ _/ /_____/_ __/ | / / + / __/ / ___/ ___/ __ `/ __/_ / / / | | / / + / /___/ / (__ ) /_/ / /_ / /_/ / | |/ / +/_____/_/ /____/\__,_/\__/ /___/_/ |___/ + +EOF +} +header_info +echo -e "Loading..." +APP="ErsatzTV" +var_disk="5" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} +function update_script() { +header_info +if [[ ! -d /opt/ErsatzTV ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + +msg_info "Stopping ErsatzTV" +systemctl stop ersatzTV +msg_ok "Stopped ErsatzTV" + +msg_info "Updating ErsatzTV" +RELEASE=$(curl -s https://api.github.com/repos/ErsatzTV/ErsatzTV/releases | grep -oP '"tag_name": "\K[^"]+' | head -n 1) +cp -R /opt/ErsatzTV/ ErsatzTV-backup +rm ErsatzTV-backup/ErsatzTV +rm -rf /opt/ErsatzTV +wget -qO- "https://github.com/ErsatzTV/ErsatzTV/releases/download/${RELEASE}/ErsatzTV-${RELEASE}-linux-x64.tar.gz" | tar -xz -C /opt +mv "/opt/ErsatzTV-${RELEASE}-linux-x64" /opt/ErsatzTV +cp -R ErsatzTV-backup/* /opt/ErsatzTV/ +rm -rf ErsatzTV-backup +msg_ok "Updated ErsatzTV" + +msg_info "Starting ErsatzTV" +systemctl start ersatzTV +msg_ok "Started ErsatzTV" +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:8409${CL} \n" diff --git a/ct/esphome.sh b/ct/esphome.sh new file mode 100644 index 00000000..7a2e0e87 --- /dev/null +++ b/ct/esphome.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___________ ____ __ __ + / ____/ ___// __ \/ / / /___ ____ ___ ___ + / __/ \__ \/ /_/ / /_/ / __ \/ __ `__ \/ _ \ + / /___ ___/ / ____/ __ / /_/ / / / / / / __/ +/_____//____/_/ /_/ /_/\____/_/ /_/ /_/\___/ + +EOF +} +header_info +echo -e "Loading..." +APP="ESPHome" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/esphomeDashboard.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Stopping ESPHome" +systemctl stop esphomeDashboard +msg_ok "Stopped ESPHome" + +msg_info "Updating ESPHome" +if [[ -d /srv/esphome ]]; then + source /srv/esphome/bin/activate &>/dev/null +fi +pip3 install -U esphome &>/dev/null +msg_ok "Updated ESPHome" + +msg_info "Starting ESPHome" +systemctl start esphomeDashboard +msg_ok "Started ESPHome" +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:6052${CL} \n" diff --git a/ct/fenrus.sh b/ct/fenrus.sh new file mode 100644 index 00000000..0f5e4d17 --- /dev/null +++ b/ct/fenrus.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: Scorpoon +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ + / ____/__ ____ _______ _______ + / /_ / _ \/ __ \/ ___/ / / / ___/ + / __/ / __/ / / / / / /_/ (__ ) +/_/ \___/_/ /_/_/ \__,_/____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Fenrus" +var_disk="4" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/${APP} ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_error "There is currently no update path available." +exit +msg_info "Updating ${APP}" +systemctl stop ${APP} +git clone https://github.com/revenz/Fenrus.git +cd Fenrus || exit +gitVersionNumber=$(git rev-parse HEAD) + +if [[ "${gitVersionNumber}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + mkdir /opt/fenrus-data-backup + cp -r "/opt/${APP}/data/" /opt/fenrus-data-backup/data + if [[ ! -d /opt/fenrus-data-backup/data ]]; then msg_error "Backup of data folder failed! exiting..."; rm -r /opt/fenrus-data-backup/; exit; fi + export DOTNET_CLI_TELEMETRY_OPTOUT=1 + dotnet publish -c Release -o "/opt/${APP}/" Fenrus.csproj + cp -r /opt/fenrus-data-backup/data/ "/opt/${APP}/" + echo "${gitVersionNumber}" >"/opt/${APP}_version.txt" + rm -r /opt/fenrus-data-backup/ + msg_ok "Updated $APP" +else + msg_ok "No update required. ${APP} is already up to date" +fi +cd .. +rm -r Fenrus/ + +systemctl start ${APP} +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5000${CL} \n" diff --git a/ct/fhem.sh b/ct/fhem.sh new file mode 100644 index 00000000..a98ce9ae --- /dev/null +++ b/ct/fhem.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ________ + / ____/ /_ ___ ____ ___ + / /_ / __ \/ _ \/ __ `__ \ + / __/ / / / / __/ / / / / / +/_/ /_/ /_/\___/_/ /_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Fhem" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/fhem.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8083${CL} \n" diff --git a/ct/flaresolverr.sh b/ct/flaresolverr.sh new file mode 100644 index 00000000..85cc927a --- /dev/null +++ b/ct/flaresolverr.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: remz1337 +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ________ _____ __ + / ____/ /___ _________ / ___/____ / / _____ __________ + / /_ / / __ `/ ___/ _ \\__ \/ __ \/ / | / / _ \/ ___/ ___/ + / __/ / / /_/ / / / __/__/ / /_/ / /| |/ / __/ / / / +/_/ /_/\__,_/_/ \___/____/\____/_/ |___/\___/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="FlareSolverr" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + header_info + if [[ ! -f /etc/systemd/system/flaresolverr.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + RELEASE=$(wget -q https://github.com/FlareSolverr/FlareSolverr/releases/latest -O - | grep "title>Release" | cut -d " " -f 4) + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Updating $APP LXC" + systemctl stop flaresolverr + wget -q https://github.com/FlareSolverr/FlareSolverr/releases/download/$RELEASE/flaresolverr_linux_x64.tar.gz + tar -xzf flaresolverr_linux_x64.tar.gz -C /opt + rm flaresolverr_linux_x64.tar.gz + systemctl start flaresolverr + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated $APP LXC" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi + exit +} + +start +build_container +description + +msg_info "Setting Container to Normal Resources" +pct set $CTID -memory 512 +pct set $CTID -cores 1 +msg_ok "Set Container to Normal Resources" +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8191${CL} \n" diff --git a/ct/flowiseai.sh b/ct/flowiseai.sh new file mode 100644 index 00000000..4dc58f6b --- /dev/null +++ b/ct/flowiseai.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ________ _ ___ ____ + / ____/ /___ _ __(_)_______ / | / _/ + / /_ / / __ \ | /| / / / ___/ _ \/ /| | / / + / __/ / / /_/ / |/ |/ / (__ ) __/ ___ |_/ / +/_/ /_/\____/|__/|__/_/____/\___/_/ |_/___/ + +EOF +} +header_info +echo -e "Loading..." +APP="FlowiseAI" +var_disk="10" +var_cpu="4" +var_ram="4096" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/flowise.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP}" +systemctl stop flowise +npm install -g flowise --upgrade +systemctl start flowise +msg_ok "Updated ${APP}" +exit +} + +start +build_container +description + +msg_info "Setting Container to Normal Resources" +pct set $CTID -memory 2048 +pct set $CTID -cores 2 +msg_ok "Set Container to Normal Resources" +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/forgejo.sh b/ct/forgejo.sh new file mode 100644 index 00000000..9df120ba --- /dev/null +++ b/ct/forgejo.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + ______ _ + / ____/___ _________ ___ (_)___ + / /_ / __ \/ ___/ __ `/ _ \ / / __ \ + / __/ / /_/ / / / /_/ / __/ / / /_/ / +/_/ \____/_/ \__, /\___/_/ /\____/ + /____/ /___/ + +EOF +} +header_info +echo -e "Loading..." +APP="Forgejo" +var_disk="10" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/forgejo ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Stopping ${APP}" +systemctl stop forgejo +msg_ok "Stopped ${APP}" + +msg_info "Updating ${APP}" +RELEASE=$(curl -s https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/latest | grep -oP '"tag_name":\s*"\K[^"]+' | sed 's/^v//') +wget -qO forgejo-$RELEASE-linux-amd64 "https://codeberg.org/forgejo/forgejo/releases/download/v${RELEASE}/forgejo-${RELEASE}-linux-amd64" +rm -rf /opt/forgejo/* +cp -r forgejo-$RELEASE-linux-amd64 /opt/forgejo/forgejo-$RELEASE-linux-amd64 +chmod +x /opt/forgejo/forgejo-$RELEASE-linux-amd64 +ln -sf /opt/forgejo/forgejo-$RELEASE-linux-amd64 /usr/local/bin/forgejo +msg_ok "Updated ${APP}" + +msg_info "Cleaning" +rm -rf forgejo-$RELEASE-linux-amd64 +msg_ok "Cleaned" + +msg_info "Starting ${APP}" +systemctl start forgejo +msg_ok "Started ${APP}" +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/frigate.sh b/ct/frigate.sh new file mode 100644 index 00000000..f3483013 --- /dev/null +++ b/ct/frigate.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Authors: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + ______ _ __ + / ____/____(_)___ _____ _/ /____ + / /_ / ___/ / __ `/ __ `/ __/ _ \ + / __/ / / / / /_/ / /_/ / /_/ __/ +/_/ /_/ /_/\__, /\__,_/\__/\___/ + /____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Frigate" +var_disk="20" +var_cpu="4" +var_ram="4096" +var_os="debian" +var_version="11" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="0" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + if [[ ! -f /etc/systemd/system/frigate.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + msg_error "There is currently no update path available." + exit +} + +start +build_container +description + +msg_info "Setting Container to Normal Resources" +pct set $CTID -memory 1024 +msg_ok "Set Container to Normal Resources" +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5000${CL} \n" +echo -e "go2rtc should be reachable by going to the following URL. + ${BL}http://${IP}:1984${CL} \n" diff --git a/ct/go2rtc.sh b/ct/go2rtc.sh new file mode 100644 index 00000000..380ed801 --- /dev/null +++ b/ct/go2rtc.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___ __ + ____ _____ |__ \ _____/ /______ + / __ `/ __ \__/ // ___/ __/ ___/ + / /_/ / /_/ / __// / / /_/ /__ + \__, /\____/____/_/ \__/\___/ +/____/ + +EOF +} +header_info +echo -e "Loading..." +APP="go2rtc" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/go2rtc ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP" +systemctl stop go2rtc +cd /opt/go2rtc +rm go2rtc_linux_amd64 +wget -q https://github.com/AlexxIT/go2rtc/releases/latest/download/go2rtc_linux_amd64 +chmod +x go2rtc_linux_amd64 +systemctl start go2rtc +msg_ok "Updated $APP" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:1984${CL} \n" diff --git a/ct/gokapi.sh b/ct/gokapi.sh new file mode 100644 index 00000000..942cc560 --- /dev/null +++ b/ct/gokapi.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ __ _ + / ____/___ / /______ _____ (_) + / / __/ __ \/ //_/ __ `/ __ \/ / +/ /_/ / /_/ / ,< / /_/ / /_/ / / +\____/\____/_/|_|\__,_/ .___/_/ + /_/ +EOF +} +header_info +echo -e "Loading..." +APP="Gokapi" +var_disk="4" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/gokapi ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_error "There is currently no update path available." +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:53842/setup${CL} \n" diff --git a/ct/gotify.sh b/ct/gotify.sh new file mode 100644 index 00000000..15f911df --- /dev/null +++ b/ct/gotify.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ __ _ ____ + / ____/___ / /_(_) __/_ __ + / / __/ __ \/ __/ / /_/ / / / +/ /_/ / /_/ / /_/ / __/ /_/ / +\____/\____/\__/_/_/ \__, / + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Gotify" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/gotify ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_error "There is currently no update path available." +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP} ${CL} \n" diff --git a/ct/grafana.sh b/ct/grafana.sh new file mode 100644 index 00000000..b5ea2aa9 --- /dev/null +++ b/ct/grafana.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ ____ + / ____/________ _/ __/___ _____ ____ _ + / / __/ ___/ __ / /_/ __ / __ \/ __ / +/ /_/ / / / /_/ / __/ /_/ / / / / /_/ / +\____/_/ \__,_/_/ \__,_/_/ /_/\__,_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Grafana" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/apt/sources.list.d/grafana.list ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP}" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/grocy.sh b/ct/grocy.sh new file mode 100644 index 00000000..fc48644b --- /dev/null +++ b/ct/grocy.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __________ _______ __ + / __ / ___/ __ \/ ___/ / / / + / /_/ / / / /_/ / /__/ /_/ / + \__, /_/ \____/\___/\__, / +/____/ /____/ + +EOF +} +header_info +echo -e "Loading..." +APP="grocy" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/apache2/sites-available/grocy.conf ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +php_version=$(php -v | head -n 1 | awk '{print $2}') +if [[ ! $php_version == "8.3"* ]]; then + msg_info "Updating PHP" + curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg + echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ bookworm main" >/etc/apt/sources.list.d/php.list + apt-get update + apt-get install -y php8.3 php8.3-cli php8.3-{bz2,curl,mbstring,intl,sqlite3,fpm,gd,zip,xml} + systemctl reload apache2 + apt autoremove + msg_ok "Updated PHP" +fi +msg_info "Updating ${APP}" +bash /var/www/html/update.sh +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}${CL} \n" diff --git a/ct/headscale.sh b/ct/headscale.sh new file mode 100644 index 00000000..f50347eb --- /dev/null +++ b/ct/headscale.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ __ __ + / / / /__ ____ _____/ /_____________ _/ /__ + / /_/ / _ \/ __ `/ __ / ___/ ___/ __ `/ / _ \ + / __ / __/ /_/ / /_/ (__ ) /__/ /_/ / / __/ +/_/ /_/\___/\__,_/\__,_/____/\___/\__,_/_/\___/ + +EOF +} +header_info +echo -e "Loading..." +APP="Headscale" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /etc/headscale ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + +RELEASE=$(curl -s https://api.github.com/repos/juanfont/headscale/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Stopping ${APP}" + systemctl stop headscale + msg_ok "Stopped ${APP}" + + msg_info "Updating $APP to v${RELEASE}" + wget -q https://github.com/juanfont/headscale/releases/download/v${RELEASE}/headscale_${RELEASE}_linux_amd64.deb + dpkg -i headscale_${RELEASE}_linux_amd64.deb + rm headscale_${RELEASE}_linux_amd64.deb + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated $APP to ${RELEASE}" + + msg_info "Starting ${APP}" + systemctl start headscale + msg_ok "Started ${APP}" + msg_ok "Updated Successfully" +else + msg_ok "No update required. ${APP} is already at ${RELEASE}" +fi +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/heimdall-dashboard.sh b/ct/heimdall-dashboard.sh new file mode 100644 index 00000000..04db1ea7 --- /dev/null +++ b/ct/heimdall-dashboard.sh @@ -0,0 +1,111 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ _ _ _ ___ _ _ _ + /\ /\___(_)_ __ ___ __| | __ _| | | / \__ _ ___| |__ | |__ ___ __ _ _ __ __| | + / /_/ / _ \ | '_ ` _ \ / _` |/ _` | | | / /\ / _` / __| '_ \| '_ \ / _ \ / _` | '__/ _` | +/ __ / __/ | | | | | | (_| | (_| | | | / /_// (_| \__ \ | | | |_) | (_) | (_| | | | (_| | +\/ /_/ \___|_|_| |_| |_|\__,_|\__,_|_|_| /___,' \__,_|___/_| |_|_.__/ \___/ \__,_|_| \__,_| + +EOF +} +header_info +echo -e "Loading..." +APP="Heimdall-Dashboard" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/Heimdall ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/Heimdall/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]') +if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Stopping ${APP}" + systemctl stop heimdall + sleep 1 + msg_ok "Stopped ${APP}" + + msg_info "Backing up Data" + cp -R /opt/Heimdall/database database-backup + cp -R /opt/Heimdall/public public-backup + sleep 1 + msg_ok "Backed up Data" + + msg_info "Updating Heimdall Dashboard to ${RELEASE}" + wget -q https://github.com/linuxserver/Heimdall/archive/${RELEASE}.tar.gz + tar xzf ${RELEASE}.tar.gz + VER=$(curl -s https://api.github.com/repos/linuxserver/Heimdall/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + cp -R Heimdall-${VER}/* /opt/Heimdall + cd /opt/Heimdall + apt-get install -y composer &>/dev/null + COMPOSER_ALLOW_SUPERUSER=1 composer dump-autoload &>/dev/null + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated Heimdall Dashboard to ${RELEASE}" + + msg_info "Restoring Data" + cd ~ + cp -R database-backup/* /opt/Heimdall/database + cp -R public-backup/* /opt/Heimdall/public + sleep 1 + msg_ok "Restored Data" + + msg_info "Cleanup" + rm -rf {${RELEASE}.tar.gz,Heimdall-${VER},public-backup,database-backup,Heimdall} + sleep 1 + msg_ok "Cleaned" + + msg_info "Starting ${APP}" + systemctl start heimdall.service + sleep 2 + msg_ok "Started ${APP}" + msg_ok "Updated Successfully" +else + msg_ok "No update required. ${APP} is already at ${RELEASE}." +fi +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:7990${CL} \n" diff --git a/ct/hivemq.sh b/ct/hivemq.sh new file mode 100644 index 00000000..80b79c81 --- /dev/null +++ b/ct/hivemq.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ___ __ _______ ____________ + / / / (_) _____ / |/ / __ \ / ____/ ____/ + / /_/ / / | / / _ \/ /|_/ / / / / / / / __/ + / __ / /| |/ / __/ / / / /_/ / / /___/ /___ +/_/ /_/_/ |___/\___/_/ /_/\___\_\ \____/_____/ + +EOF +} +header_info +echo -e "Loading..." +APP="HiveMQ" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_error "There is currently no update path available." +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/homarr.sh b/ct/homarr.sh new file mode 100644 index 00000000..a42089f9 --- /dev/null +++ b/ct/homarr.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ + / / / /___ ____ ___ ____ ___________ + / /_/ / __ \/ __ `__ \/ __ `/ ___/ ___/ + / __ / /_/ / / / / / / /_/ / / / / +/_/ /_/\____/_/ /_/ /_/\__,_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Homarr" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/homarr ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP (Patience)" +systemctl stop homarr +cd /opt/homarr +if ! git pull; then + echo "Already up to date." + systemctl start homarr + echo "No update required." + exit +fi +yarn install +yarn build +systemctl start homarr +msg_ok "Updated $APP" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/homeassistant-core.sh b/ct/homeassistant-core.sh new file mode 100644 index 00000000..01c1c36f --- /dev/null +++ b/ct/homeassistant-core.sh @@ -0,0 +1,156 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + _ _ _ _ ___ + /\ /\___ _ __ ___ ___ /_\ ___ ___(_)___| |_ __ _ _ __ | |_ / __\___ _ __ ___ + / /_/ / _ \| '_ ` _ \ / _ \ //_\\/ __/ __| / __| __/ _` | '_ \| __| / / / _ \| '__/ _ \ +/ __ / (_) | | | | | | __/ / _ \__ \__ \ \__ \ || (_| | | | | |_ / /__| (_) | | | __/ +\/ /_/ \___/|_| |_| |_|\___| \_/ \_/___/___/_|___/\__\__,_|_| |_|\__| \____/\___/|_| \___| + +EOF +} +header_info +echo -e "Loading..." +APP="Home Assistant-Core" +var_disk="8" +var_cpu="2" +var_ram="1024" +var_os="ubuntu" +var_version="24.04" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + if [[ ! -d /srv/homeassistant ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + PY=$(ls /srv/homeassistant/lib/) + IP=$(hostname -I | awk '{print $1}') + UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UPDATE" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 4 \ + "1" "Update Core" ON \ + "2" "Install HACS" OFF \ + "3" "Install FileBrowser" OFF \ + 3>&1 1>&2 2>&3) + header_info + if [ "$UPD" == "1" ]; then + if (whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "SELECT BRANCH" --yesno "Use Beta Branch?" 10 58); then + clear + header_info + echo -e "${GN}Updating to Beta Version${CL}" + BR="--pre " + else + clear + header_info + echo -e "${GN}Updating to Stable Version${CL}" + BR="" + fi + if [[ "$PY" == "python3.11" ]]; then echo -e "⚠️ Home Assistant will soon require Python 3.12."; fi + + msg_info "Stopping Home Assistant" + systemctl stop homeassistant + msg_ok "Stopped Home Assistant" + + msg_info "Updating Home Assistant" + source /srv/homeassistant/bin/activate + pip install ${BR}--upgrade homeassistant &>/dev/null + msg_ok "Updated Home Assistant" + + msg_info "Starting Home Assistant" + systemctl start homeassistant + sleep 2 + msg_ok "Started Home Assistant" + msg_ok "Update Successful" + echo -e "\n Go to http://${IP}:8123 \n" + exit + fi + if [ "$UPD" == "2" ]; then + msg_info "Installing Home Assistant Community Store (HACS)" + apt update &>/dev/null + apt install unzip &>/dev/null + cd .homeassistant + bash <(curl -fsSL https://get.hacs.xyz) &>/dev/null + msg_ok "Installed Home Assistant Community Store (HACS)" + echo -e "\n Reboot Home Assistant and clear browser cache then Add HACS integration.\n" + exit + fi + if [ "$UPD" == "3" ]; then + set +Eeuo pipefail + read -r -p "Would you like to use No Authentication? " prompt + msg_info "Installing FileBrowser" + RELEASE=$(curl -fsSL https://api.github.com/repos/filebrowser/filebrowser/releases/latest | grep -o '"tag_name": ".*"' | sed 's/"//g' | sed 's/tag_name: //g') + curl -fsSL https://github.com/filebrowser/filebrowser/releases/download/$RELEASE/linux-amd64-filebrowser.tar.gz | tar -xzv -C /usr/local/bin &>/dev/null + + if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + filebrowser config init -a '0.0.0.0' &>/dev/null + filebrowser config set -a '0.0.0.0' &>/dev/null + filebrowser config set --auth.method=noauth &>/dev/null + filebrowser users add ID 1 --perm.admin &>/dev/null + else + filebrowser config init -a '0.0.0.0' &>/dev/null + filebrowser config set -a '0.0.0.0' &>/dev/null + filebrowser users add admin changeme --perm.admin &>/dev/null + fi + msg_ok "Installed FileBrowser" + + msg_info "Creating Service" + service_path="/etc/systemd/system/filebrowser.service" + echo "[Unit] +Description=Filebrowser +After=network-online.target +[Service] +User=root +WorkingDirectory=/root/ +ExecStart=/usr/local/bin/filebrowser -r /root/.homeassistant +[Install] +WantedBy=default.target" >$service_path + + systemctl enable --now -q filebrowser.service + msg_ok "Created Service" + + msg_ok "Completed Successfully!\n" + echo -e "FileBrowser should be reachable by going to the following URL. + ${BL}http://$IP:8080${CL} admin|changeme\n" + exit + fi +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8123${CL}" diff --git a/ct/homeassistant.sh b/ct/homeassistant.sh new file mode 100644 index 00000000..3f2c63ed --- /dev/null +++ b/ct/homeassistant.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + __ __ ___ _ __ __ + / / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_ + / /_/ / __ \/ __ __ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ / __ \/ __/ + / __ / /_/ / / / / / / __/ / ___ |(__ |__ ) (__ ) /_/ /_/ / / / / /_ +/_/ /_/\____/_/ /_/ /_/\___/ /_/ |_/____/____/_/____/\__/\__,_/_/ /_/\__/ + +EOF +} +header_info +echo -e "Loading..." +APP="Home Assistant" +var_disk="16" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + if [[ ! -d /var/lib/docker/volumes/hass_config/_data ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UPDATE" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 4 \ + "1" "Update ALL Containers" ON \ + "2" "Remove ALL Unused Images" OFF \ + "3" "Install HACS" OFF \ + "4" "Install FileBrowser" OFF \ + 3>&1 1>&2 2>&3) + header_info + if [ "$UPD" == "1" ]; then + msg_info "Updating All Containers" + CONTAINER_LIST="${1:-$(docker ps -q)}" + for container in ${CONTAINER_LIST}; do + CONTAINER_IMAGE="$(docker inspect --format "{{.Config.Image}}" --type container ${container})" + RUNNING_IMAGE="$(docker inspect --format "{{.Image}}" --type container "${container}")" + docker pull "${CONTAINER_IMAGE}" + LATEST_IMAGE="$(docker inspect --format "{{.Id}}" --type image "${CONTAINER_IMAGE}")" + if [[ "${RUNNING_IMAGE}" != "${LATEST_IMAGE}" ]]; then + echo "Updating ${container} image ${CONTAINER_IMAGE}" + DOCKER_COMMAND="$(runlike "${container}")" + docker rm --force "${container}" + eval ${DOCKER_COMMAND} + fi + done + msg_ok "Updated All Containers" + exit + fi + if [ "$UPD" == "2" ]; then + msg_info "Removing ALL Unused Images" + docker image prune -af + msg_ok "Removed ALL Unused Images" + exit + fi + if [ "$UPD" == "3" ]; then + msg_info "Installing Home Assistant Community Store (HACS)" + apt update &>/dev/null + apt install unzip &>/dev/null + cd /var/lib/docker/volumes/hass_config/_data + bash <(curl -fsSL https://get.hacs.xyz) &>/dev/null + msg_ok "Installed Home Assistant Community Store (HACS)" + echo -e "\n Reboot Home Assistant and clear browser cache then Add HACS integration.\n" + exit + fi + if [ "$UPD" == "4" ]; then + IP=$(hostname -I | awk '{print $1}') + msg_info "Installing FileBrowser" + RELEASE=$(curl -fsSL https://api.github.com/repos/filebrowser/filebrowser/releases/latest | grep -o '"tag_name": ".*"' | sed 's/"//g' | sed 's/tag_name: //g') + curl -fsSL https://github.com/filebrowser/filebrowser/releases/download/v2.23.0/linux-amd64-filebrowser.tar.gz | tar -xzv -C /usr/local/bin &>/dev/null + filebrowser config init -a '0.0.0.0' &>/dev/null + filebrowser config set -a '0.0.0.0' &>/dev/null + filebrowser users add admin changeme --perm.admin &>/dev/null + msg_ok "Installed FileBrowser" + + msg_info "Creating Service" + service_path="/etc/systemd/system/filebrowser.service" + echo "[Unit] +Description=Filebrowser +After=network-online.target +[Service] +User=root +WorkingDirectory=/root/ +ExecStart=/usr/local/bin/filebrowser -r / +[Install] +WantedBy=default.target" >$service_path + + systemctl enable --now filebrowser.service &>/dev/null + msg_ok "Created Service" + + msg_ok "Completed Successfully!\n" + echo -e "FileBrowser should be reachable by going to the following URL. + ${BL}http://$IP:8080${CL} admin|changeme\n" + exit + fi +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8123${CL} +Portainer should be reachable by going to the following URL. + ${BL}https://${IP}:9443${CL}\n" diff --git a/ct/homebridge.sh b/ct/homebridge.sh new file mode 100644 index 00000000..d252b52b --- /dev/null +++ b/ct/homebridge.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ______ __ _____________ ____ ________ ____________ + / / / / __ \/ |/ / ____/ __ )/ __ \/ _/ __ \/ ____/ ____/ + / /_/ / / / / /|_/ / __/ / __ / /_/ // // / / / / __/ __/ + / __ / /_/ / / / / /___/ /_/ / _, _// // /_/ / /_/ / /___ +/_/ /_/\____/_/ /_/_____/_____/_/ |_/___/_____/\____/_____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Homebridge" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/apt/sources.list.d/homebridge.list ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get install -y homebridge &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8581${CL} \n" diff --git a/ct/homepage.sh b/ct/homepage.sh new file mode 100644 index 00000000..716da76b --- /dev/null +++ b/ct/homepage.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ + / / / /___ ____ ___ ___ ____ ____ _____ ____ + / /_/ / __ \/ __ `__ \/ _ \/ __ \/ __ `/ __ `/ _ \ + / __ / /_/ / / / / / / __/ /_/ / /_/ / /_/ / __/ +/_/ /_/\____/_/ /_/ /_/\___/ .___/\__,_/\__, /\___/ + /_/ /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Homepage" +var_disk="3" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/homepage ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +if [[ "$(node -v | cut -d 'v' -f 2)" == "18."* ]]; then + if ! command -v npm >/dev/null 2>&1; then + echo "Installing NPM..." + apt-get install -y npm >/dev/null 2>&1 + npm install -g pnpm >/dev/null 2>&1 + echo "Installed NPM..." + fi +fi +RELEASE=$(curl -s https://api.github.com/repos/gethomepage/homepage/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Updating Homepage to v${RELEASE} (Patience)" + systemctl stop homepage + wget -q https://github.com/gethomepage/homepage/archive/refs/tags/v${RELEASE}.tar.gz + tar -xzf v${RELEASE}.tar.gz + rm -rf v${RELEASE}.tar.gz + cp -r homepage-${RELEASE}/* /opt/homepage/ + rm -rf homepage-${RELEASE} + cd /opt/homepage + npx update-browserslist-db@latest + pnpm install + pnpm build + systemctl start homepage + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated Homepage to v${RELEASE}" +else + msg_ok "No update required. ${APP} is already at ${RELEASE}" +fi +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/homer.sh b/ct/homer.sh new file mode 100644 index 00000000..bfec3090 --- /dev/null +++ b/ct/homer.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ + / / / /___ ____ ___ ___ _____ + / /_/ / __ \/ __ `__ \/ _ \/ ___/ + / __ / /_/ / / / / / / __/ / +/_/ /_/\____/_/ /_/ /_/\___/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Homer" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/homer ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Stopping ${APP}" +systemctl stop homer +msg_ok "Stopped ${APP}" + +msg_info "Backing up assets directory" +cd ~ +mkdir -p assets-backup +cp -R /opt/homer/assets/. assets-backup +msg_ok "Backed up assets directory" + +msg_info "Updating ${APP}" +rm -rf /opt/homer/* +cd /opt/homer +wget -q https://github.com/bastienwirtz/homer/releases/latest/download/homer.zip +unzip homer.zip &>/dev/null +msg_ok "Updated ${APP}" + +msg_info "Restoring assets directory" +cd ~ +cp -Rf assets-backup/. /opt/homer/assets/ +msg_ok "Restored assets directory" + +msg_info "Cleaning" +rm -rf assets-backup /opt/homer/homer.zip +msg_ok "Cleaned" + +msg_info "Starting ${APP}" +systemctl start homer +msg_ok "Started ${APP}" +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8010${CL} \n" diff --git a/ct/hyperhdr.sh b/ct/hyperhdr.sh new file mode 100644 index 00000000..7c04a596 --- /dev/null +++ b/ct/hyperhdr.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ __ ______ ____ + / / / /_ ______ ___ _____/ / / / __ \/ __ \ + / /_/ / / / / __ \/ _ \/ ___/ /_/ / / / / /_/ / + / __ / /_/ / /_/ / __/ / / __ / /_/ / _, _/ +/_/ /_/\__, / .___/\___/_/ /_/ /_/_____/_/ |_| + /____/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="HyperHDR" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="0" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8090${CL} \n" diff --git a/ct/hyperion.sh b/ct/hyperion.sh new file mode 100644 index 00000000..4edd8dd8 --- /dev/null +++ b/ct/hyperion.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ _ + / / / /_ ______ ___ _____(_)___ ____ + / /_/ / / / / __ \/ _ \/ ___/ / __ \/ __ \ + / __ / /_/ / /_/ / __/ / / / /_/ / / / / +/_/ /_/\__, / .___/\___/_/ /_/\____/_/ /_/ + /____/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Hyperion" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/apt/sources.list.d/hyperion.list ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get install -y hyperion &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8090${CL} \n" diff --git a/ct/influxdb.sh b/ct/influxdb.sh new file mode 100644 index 00000000..2d995f6b --- /dev/null +++ b/ct/influxdb.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ ______ ____ ____ + / _/___ / __/ /_ ___ __/ __ \/ __ ) + / // __ \/ /_/ / / / / |/_/ / / / __ | + _/ // / / / __/ / /_/ /> /dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/iobroker.sh b/ct/iobroker.sh new file mode 100644 index 00000000..0bbd1d0f --- /dev/null +++ b/ct/iobroker.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ ____ __ + (_)___ / __ )_________ / /_____ _____ + / / __ \/ __ / ___/ __ \/ //_/ _ \/ ___/ + / / /_/ / /_/ / / / /_/ / ,< / __/ / +/_/\____/_____/_/ \____/_/|_|\___/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="ioBroker" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/iobroker ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8081${CL} \n" diff --git a/ct/iventoy.sh b/ct/iventoy.sh new file mode 100644 index 00000000..08e067ab --- /dev/null +++ b/ct/iventoy.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ _ __ __ + (_) | / /__ ____ / /_____ __ __ + / /| | / / _ \/ __ \/ __/ __ \/ / / / + / / | |/ / __/ / / / /_/ /_/ / /_/ / +/_/ |___/\___/_/ /_/\__/\____/\__, / + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="iVentoy" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="0" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +if [[ ! -d /opt/iventoy ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_error "There is currently no update path available." +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:26000/ ${CL} \n" \ No newline at end of file diff --git a/ct/jackett.sh b/ct/jackett.sh new file mode 100644 index 00000000..278373d0 --- /dev/null +++ b/ct/jackett.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ __ __ + / /___ ______/ /_____ / /_/ /_ + __ / / __ `/ ___/ //_/ _ \/ __/ __/ +/ /_/ / /_/ / /__/ ,< / __/ /_/ /_ +\____/\__,_/\___/_/|_|\___/\__/\__/ + +EOF +} +header_info +echo -e "Loading..." +APP="Jackett" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/jackett.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +RELEASE=$(wget -q https://github.com/Jackett/Jackett/releases/latest -O - | grep "title>Release" | cut -d " " -f 4) +if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + msg_info "Updating ${APP}" + wget -q https://github.com/Jackett/Jackett/releases/download/$RELEASE/Jackett.Binaries.LinuxAMDx64.tar.gz + systemctl stop jackett + rm -rf /opt/Jackett + tar -xzf Jackett.Binaries.LinuxAMDx64.tar.gz -C /opt + rm -rf Jackett.Binaries.LinuxAMDx64.tar.gz + systemctl start jackett + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated ${APP} to ${RELEASE}" +else + msg_ok "No update required. ${APP} is already at ${RELEASE}" +fi +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:9117${CL}\n" diff --git a/ct/jellyfin.sh b/ct/jellyfin.sh new file mode 100644 index 00000000..079836c2 --- /dev/null +++ b/ct/jellyfin.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ____ _____ + / /__ / / /_ __/ __(_)___ + __ / / _ \/ / / / / / /_/ / __ \ +/ /_/ / __/ / / /_/ / __/ / / / / +\____/\___/_/_/\__, /_/ /_/_/ /_/ + /____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Jellyfin" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="ubuntu" +var_version="22.04" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /usr/lib/jellyfin ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated ${APP} LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8096${CL}\n" diff --git a/ct/jellyseerr.sh b/ct/jellyseerr.sh new file mode 100644 index 00000000..5f3548bf --- /dev/null +++ b/ct/jellyseerr.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ____ + / /__ / / /_ __________ ___ __________ + __ / / _ \/ / / / / / ___/ _ \/ _ \/ ___/ ___/ +/ /_/ / __/ / / /_/ (__ ) __/ __/ / / / +\____/\___/_/_/\__, /____/\___/\___/_/ /_/ + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Jellyseerr" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/jellyseerr ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP" +systemctl stop jellyseerr +cd /opt/jellyseerr +output=$(git pull) +git pull &>/dev/null +if echo "$output" | grep -q "Already up to date." +then + msg_ok " $APP is already up to date." + systemctl start jellyseerr + exit +fi +CYPRESS_INSTALL_BINARY=0 yarn install --frozen-lockfile --network-timeout 1000000 &>/dev/null +yarn build &>/dev/null +systemctl start jellyseerr +msg_ok "Updated $APP" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5055${CL} \n" diff --git a/ct/k0s.sh b/ct/k0s.sh new file mode 100644 index 00000000..3b62bfc6 --- /dev/null +++ b/ct/k0s.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ____ __ __ __ __ + / /__/ __ \_____ / //_/_ __/ /_ ___ _________ ___ / /____ _____ + / //_/ / / / ___/ / ,< / / / / __ \/ _ \/ ___/ __ \/ _ \/ __/ _ \/ ___/ + / ,< / /_/ (__ ) / /| / /_/ / /_/ / __/ / / / / / __/ /_/ __(__ ) +/_/|_|\____/____/ /_/ |_\__,_/_.___/\___/_/ /_/ /_/\___/\__/\___/____/ + +EOF +} +header_info +echo -e "Loading..." +APP="k0s" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="11" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/k0s/k0s.yaml ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/kavita.sh b/ct/kavita.sh new file mode 100644 index 00000000..206778fb --- /dev/null +++ b/ct/kavita.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ _ __ + / //_/___ __ __(_) /_____ _ + / ,< / __ `/ | / / / __/ __ `/ + / /| / /_/ /| |/ / / /_/ /_/ / +/_/ |_\__,_/ |___/_/\__/\__,_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Kavita" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/Kavita ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +systemctl stop kavita +RELEASE=$(curl -s https://api.github.com/repos/Kareadita/Kavita/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +tar -xvzf <(curl -fsSL https://github.com/Kareadita/Kavita/releases/download/$RELEASE/kavita-linux-x64.tar.gz) --no-same-owner &>/dev/null +rm -rf Kavita/config +cp -r Kavita/* /opt/Kavita +rm -rf Kavita +systemctl start kavita +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5000${CL} \n" diff --git a/ct/keycloak.sh b/ct/keycloak.sh new file mode 100644 index 00000000..5e461722 --- /dev/null +++ b/ct/keycloak.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ __ __ + / //_/__ __ _______/ /___ ____ _/ /__ + / ,< / _ \/ / / / ___/ / __ \/ __ / //_/ + / /| / __/ /_/ / /__/ / /_/ / /_/ / ,< +/_/ |_\___/\__, /\___/_/\____/\__,_/_/|_| + /____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Keycloak" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/keycloak.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8080${CL} \n" diff --git a/ct/kubo.sh b/ct/kubo.sh new file mode 100644 index 00000000..e792b791 --- /dev/null +++ b/ct/kubo.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: ulmentflam +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ __ + / //_/_ __/ /_ ____ + / ,< / / / / __ \/ __ \ + / /| / /_/ / /_/ / /_/ / +/_/ |_\__,_/_.___/\____/ +EOF +} +header_info +echo -e "Loading..." +APP="Kubo" +var_disk="4" +var_cpu="2" +var_ram="4096" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /usr/local/kubo ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +RELEASE=$(wget -q https://github.com/ipfs/kubo/releases/latest -O - | grep "title>Release" | cut -d " " -f 4) +if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Updating $APP LXC" + apt-get update &>/dev/null + apt-get -y upgrade &>/dev/null + wget -q "https://github.com/ipfs/kubo/releases/download/${RELEASE}/kubo_${RELEASE}_linux-amd64.tar.gz" + tar -xzf "kubo_${RELEASE}_linux-amd64.tar.gz" -C /usr/local + systemctl restart ipfs.service + echo "${RELEASE}" >/opt/${APP}_version.txt + rm "kubo_${RELEASE}_linux-amd64.tar.gz" + msg_ok "Updated $APP LXC" +else + msg_ok "No update required. ${APP} is already at ${RELEASE}" +fi +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5001/webui ${CL} \n" diff --git a/ct/lazylibrarian.sh b/ct/lazylibrarian.sh new file mode 100644 index 00000000..9f29dc43 --- /dev/null +++ b/ct/lazylibrarian.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MountyMapleSyrup (MountyMapleSyrup) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ _ __ _ + / / ____ _____ __ __/ / (_) /_ _________ ______(_)___ _____ + / / / __ `/_ / / / / / / / / __ \/ ___/ __ `/ ___/ / __ `/ __ \ + / /___/ /_/ / / /_/ /_/ / /___/ / /_/ / / / /_/ / / / / /_/ / / / / +/_____/\__,_/ /___/\__, /_____/_/_.___/_/ \__,_/_/ /_/\__,_/_/ /_/ + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="LazyLibrarian" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/LazyLibrarian/ ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Stopping LazyLibrarian" +systemctl stop lazylibrarian +msg_ok "LazyLibrarian Stopped" + +msg_info "Updating $APP LXC" +git -C /opt/LazyLibrarian pull origin master &>/dev/null +msg_ok "Updated $APP LXC" + +msg_info "Starting LazyLibrarian" +systemctl start lazylibrarian +msg_ok "Started LazyLibrarian" + +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5299${CL} \n" diff --git a/ct/lidarr.sh b/ct/lidarr.sh new file mode 100644 index 00000000..9628b885 --- /dev/null +++ b/ct/lidarr.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ _ __ + / / (_)___/ /___ __________ + / / / / __ / __ `/ ___/ ___/ + / /___/ / /_/ / /_/ / / / / +/_____/_/\__,_/\__,_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Lidarr" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var/lib/lidarr/ ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8686${CL} \n" diff --git a/ct/linkwarden.sh b/ct/linkwarden.sh new file mode 100644 index 00000000..e5c0494a --- /dev/null +++ b/ct/linkwarden.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ _ __ __ + / / (_)___ / /___ ______ __________/ /__ ____ + / / / / __ \/ //_/ | /| / / __ `/ ___/ __ / _ \/ __ \ + / /___/ / / / / ,< | |/ |/ / /_/ / / / /_/ / __/ / / / +/_____/_/_/ /_/_/|_| |__/|__/\__,_/_/ \__,_/\___/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Linkwarden" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="ubuntu" +var_version="22.04" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/linkwarden ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + +RELEASE=$(curl -s https://api.github.com/repos/linkwarden/linkwarden/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 + msg_info "Stopping ${APP}" + systemctl stop linkwarden + msg_ok "Stopped ${APP}" + + msg_info "Updating ${APP} to ${RELEASE}" + cd /opt/linkwarden + git pull + yarn + npx playwright install-deps + yarn prisma generate + yarn build + yarn prisma migrate deploy + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated ${APP} to ${RELEASE}" + + msg_info "Starting ${APP}" + systemctl start linkwarden + msg_ok "Started ${APP}" + msg_ok "Updated Successfully" +else + msg_ok "No update required. ${APP} is already at ${RELEASE}." +fi +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP}${CL} should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/mafl.sh b/ct/mafl.sh new file mode 100644 index 00000000..2dfee171 --- /dev/null +++ b/ct/mafl.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + __ ___ ______ + / |/ /___ _/ __/ / + / /|_/ / __ `/ /_/ / + / / / / /_/ / __/ / +/_/ /_/\__,_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Mafl" +var_disk="6" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + header_info + if [[ ! -d /opt/mafl ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + + RELEASE=$(curl -s https://api.github.com/repos/hywax/mafl/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + msg_info "Updating Mafl to v${RELEASE} (Patience)" + systemctl stop mafl + wget -q https://github.com/hywax/mafl/archive/refs/tags/v${RELEASE}.tar.gz + tar -xzf v${RELEASE}.tar.gz + cp -r mafl-${RELEASE}/* /opt/mafl/ + rm -rf mafl-${RELEASE} + cd /opt/mafl + yarn install + yarn build + systemctl start mafl + msg_ok "Updated Mafl to v${RELEASE}" + exit +} + +start +build_container +description + +msg_info "Setting Container to Normal Resources" +pct set $CTID -memory 1024 +pct set $CTID -cores 1 +msg_ok "Set Container to Normal Resources" + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/magicmirror.sh b/ct/magicmirror.sh new file mode 100644 index 00000000..bb5e0b7b --- /dev/null +++ b/ct/magicmirror.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ___ _ __ ____ + / |/ /___ _____ _(_)____/ |/ (_)_____________ _____ + / /|_/ / __ / __ / / ___/ /|_/ / / ___/ ___/ __ \/ ___/ + / / / / /_/ / /_/ / / /__/ / / / / / / / / /_/ / / +/_/ /_/\__,_/\__, /_/\___/_/ /_/_/_/ /_/ \____/_/ + /____/ + +EOF +} +header_info +echo -e "Loading..." +APP="MagicMirror" +var_disk="3" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/magicmirror ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + if [[ "$(node -v | cut -d 'v' -f 2)" == "18."* ]]; then + if ! command -v npm >/dev/null 2>&1; then + echo "Installing NPM..." + apt-get install -y npm >/dev/null 2>&1 + echo "Installed NPM..." + fi + fi +msg_info "Updating ${APP} LXC" +cd /opt/magicmirror +git pull &>/dev/null +npm install --only=prod --omit=dev &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8080${CL} \n" diff --git a/ct/mariadb.sh b/ct/mariadb.sh new file mode 100644 index 00000000..2b3eef00 --- /dev/null +++ b/ct/mariadb.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ___ _ ____ ____ + / |/ /___ ______(_)___ _/ __ \/ __ ) + / /|_/ / __ / ___/ / __ / / / / __ | + / / / / /_/ / / / / /_/ / /_/ / /_/ / +/_/ /_/\__,_/_/ /_/\__,_/_____/_____/ + +EOF +} +header_info +echo -e "Loading..." +APP="MariaDB" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/apt/sources.list.d/mariadb.list ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/matterbridge.sh b/ct/matterbridge.sh new file mode 100644 index 00000000..e0d04f26 --- /dev/null +++ b/ct/matterbridge.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ___ __ __ __ _ __ + / |/ /___ _/ /_/ /____ _____/ /_ _____(_)___/ /___ ____ + / /|_/ / __ `/ __/ __/ _ \/ ___/ __ \/ ___/ / __ / __ `/ _ \ + / / / / /_/ / /_/ /_/ __/ / / /_/ / / / / /_/ / /_/ / __/ +/_/ /_/\__,_/\__/\__/\___/_/ /_.___/_/ /_/\__,_/\__, /\___/ + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Matterbridge" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/matterbridge ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + +RELEASE=$(curl -s https://api.github.com/repos/Luligu/matterbridge/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}') +if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + msg_info "Stopping ${APP} Service" + systemctl stop matterbridge + msg_ok "Stopped ${APP} Service" + + msg_info "Updating ${APP} to ${RELEASE}" + cd /opt/matterbridge + wget -q "https://github.com/Luligu/matterbridge/archive/refs/tags/${RELEASE}.zip" + unzip -q ${RELEASE}.zip + mv matterbridge-${RELEASE} /opt/matterbridge + cd /opt/matterbridge + npm ci >/dev/null 2>&1 + npm run build >/dev/null 2>&1 + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated ${APP} to ${RELEASE}" + + msg_info "Cleaning up" + rm /opt/${RELEASE}.zip + msg_ok "Cleaned" + + msg_info "Starting ${APP} Service" + systemctl start matterbridge + sleep 1 + msg_ok "Started ${APP} Service" + msg_ok "Updated Successfully!\n" +else + msg_ok "No update required. ${APP} is already at ${RELEASE}" +fi +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:8283${CL} \n" diff --git a/ct/mediamtx.sh b/ct/mediamtx.sh new file mode 100644 index 00000000..83e660eb --- /dev/null +++ b/ct/mediamtx.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ___ ___ __ __________ __ + / |/ /__ ____/ (_)___ _/ |/ /_ __/ |/ / + / /|_/ / _ \/ __ / / __ `/ /|_/ / / / | / + / / / / __/ /_/ / / /_/ / / / / / / / | +/_/ /_/\___/\__,_/_/\__,_/_/ /_/ /_/ /_/|_| + +EOF +} +header_info +echo -e "Loading..." +APP="MediaMTX" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/mediamtx/ ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + +msg_error "There is currently no update path available." +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/medusa.sh b/ct/medusa.sh new file mode 100644 index 00000000..d617a114 --- /dev/null +++ b/ct/medusa.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ___ __ + / |/ /__ ____/ /_ ___________ _ + / /|_/ / _ \/ __ / / / / ___/ __ `/ + / / / / __/ /_/ / /_/ (__ ) /_/ / +/_/ /_/\___/\__,_/\__,_/____/\__,_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Medusa" +var_disk="6" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/medusa ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP}" +systemctl stop medusa.service +/opt/medusa +git pull +systemctl start medusa.service +msg_ok "Successfully Updated ${APP}" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8081${CL} \n" diff --git a/ct/meshcentral.sh b/ct/meshcentral.sh new file mode 100644 index 00000000..1040a700 --- /dev/null +++ b/ct/meshcentral.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ___ __ ______ __ __ + / |/ /__ _____/ /_ / ____/__ ____ / /__________ _/ / + / /|_/ / _ \/ ___/ __ \/ / / _ \/ __ \/ __/ ___/ __ / / + / / / / __(__ ) / / / /___/ __/ / / / /_/ / / /_/ / / +/_/ /_/\___/____/_/ /_/\____/\___/_/ /_/\__/_/ \__,_/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="MeshCentral" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/meshcentral ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}${CL} \n" diff --git a/ct/metube.sh b/ct/metube.sh new file mode 100644 index 00000000..57d8b46b --- /dev/null +++ b/ct/metube.sh @@ -0,0 +1,100 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ___ ______ __ + / |/ /__/_ __/_ __/ /_ ___ + / /|_/ / _ \/ / / / / / __ \/ _ \ + / / / / __/ / / /_/ / /_/ / __/ +/_/ /_/\___/_/ \__,_/_.___/\___/ + +EOF +} +header_info +echo -e "Loading..." +APP="MeTube" +var_disk="10" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/metube ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +if (( $(df /boot | awk 'NR==2{gsub("%","",$5); print $5}') > 80 )); then + read -r -p "Warning: Storage is dangerously low, continue anyway? " prompt + [[ ${prompt,,} =~ ^(y|yes)$ ]] || exit +fi +msg_info "Stopping ${APP} Service" +systemctl stop metube +msg_ok "Stopped ${APP} Service" + +msg_info "Updating ${APP} to latest Git" +cd /opt +if [ -d metube_bak ]; then + rm -rf metube_bak +fi +mv metube metube_bak +git clone https://github.com/alexta69/metube /opt/metube >/dev/null 2>&1 +cd /opt/metube/ui +npm install >/dev/null 2>&1 +node_modules/.bin/ng build >/dev/null 2>&1 +cd /opt/metube +cp /opt/metube_bak/.env /opt/metube/ +pip3 install pipenv >/dev/null 2>&1 +pipenv install >/dev/null 2>&1 + +if [ -d "/opt/metube_bak" ]; then +rm -rf /opt/metube_bak +fi +msg_ok "Updated ${APP} to latest Git" + +msg_info "Starting ${APP} Service" +systemctl start metube +sleep 1 +msg_ok "Started ${APP} Service" +msg_ok "Updated Successfully!\n" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:8081${CL} \n" \ No newline at end of file diff --git a/ct/mongodb.sh b/ct/mongodb.sh new file mode 100644 index 00000000..5b88ca4b --- /dev/null +++ b/ct/mongodb.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ___ ____ ____ + / |/ /___ ____ ____ _____ / __ \/ __ ) + / /|_/ / __ \/ __ \/ __ `/ __ \/ / / / __ | + / / / / /_/ / / / / /_/ / /_/ / /_/ / /_/ / +/_/ /_/\____/_/ /_/\__, /\____/_____/_____/ + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="MongoDB" +var_disk="4" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/apt/sources.list.d/mongodb-org-7.0.list ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/motioneye.sh b/ct/motioneye.sh new file mode 100644 index 00000000..d5a2579f --- /dev/null +++ b/ct/motioneye.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ___ __ _ + / |/ /___ / /_(_)___ ____ ___ __ _____ + / /|_/ / __ \/ __/ / __ \/ __ \/ _ \/ / / / _ \ + / / / / /_/ / /_/ / /_/ / / / / __/ /_/ / __/ +/_/ /_/\____/\__/_/\____/_/ /_/\___/\__, /\___/ + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Motioneye" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/motioneye.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +pip install motioneye --upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8765${CL} \n" diff --git a/ct/mqtt.sh b/ct/mqtt.sh new file mode 100644 index 00000000..b79777df --- /dev/null +++ b/ct/mqtt.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ___ ____ _ ____________ + / |/ /___ _____/ __ \__ __(_)_ __/_ __/___ + / /|_/ / __ \/ ___/ / / / / / / / / / / / / __ \ + / / / / /_/ (__ ) /_/ / /_/ / / / / / / / /_/ / +/_/ /_/\____/____/\___\_\__,_/_/ /_/ /_/ \____/ + +EOF +} +header_info +echo -e "Loading..." +APP="MQTT" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/mosquitto/conf.d/default.conf ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/myspeed.sh b/ct/myspeed.sh new file mode 100644 index 00000000..23c98878 --- /dev/null +++ b/ct/myspeed.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ___ _____ __ + / |/ /_ __/ ___/____ ___ ___ ____/ / + / /|_/ / / / /\__ \/ __ \/ _ \/ _ \/ __ / + / / / / /_/ /___/ / /_/ / __/ __/ /_/ / +/_/ /_/\__, //____/ .___/\___/\___/\__,_/ + /____/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="MySpeed" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/myspeed ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +if (( $(df /boot | awk 'NR==2{gsub("%","",$5); print $5}') > 80 )); then + read -r -p "Warning: Storage is dangerously low, continue anyway? " prompt + [[ ${prompt,,} =~ ^(y|yes)$ ]] || exit +fi +RELEASE=$(wget -q https://github.com/gnmyt/myspeed/releases/latest -O - | grep "title>Release" | cut -d " " -f 5) +if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + + msg_info "Stopping ${APP} Service" + systemctl stop myspeed + msg_ok "Stopped ${APP} Service" + + msg_info "Updating ${APP} to ${RELEASE}" + cd /opt + rm -rf myspeed_bak + mv myspeed myspeed_bak + wget -q https://github.com/gnmyt/myspeed/releases/download/v$RELEASE/MySpeed-$RELEASE.zip + unzip -q MySpeed-$RELEASE.zip -d myspeed + cd myspeed + npm install >/dev/null 2>&1 + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated ${APP} to ${RELEASE}" + + msg_info "Starting ${APP} Service" + systemctl start myspeed + msg_ok "Started ${APP} Service" + + msg_info "Cleaning up" + rm -rf MySpeed-$RELEASE.zip + msg_ok "Cleaned" + + msg_ok "Updated Successfully!\n" +else + msg_ok "No update required. ${APP} is already at ${RELEASE}" +fi +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:5216${CL} \n" diff --git a/ct/n8n.sh b/ct/n8n.sh new file mode 100644 index 00000000..3abc7328 --- /dev/null +++ b/ct/n8n.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___ + / _ \ + _ __ | (_) |____ + | _ \ > _ <| _ \ + | | | | (_) | | | | + |_| |_|\___/|_| |_| + +EOF +} +header_info +echo -e "Loading..." +APP="n8n" +var_disk="6" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/n8n.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + if [[ "$(node -v | cut -d 'v' -f 2)" == "18."* ]]; then + if ! command -v npm >/dev/null 2>&1; then + echo "Installing NPM..." + apt-get install -y npm >/dev/null 2>&1 + echo "Installed NPM..." + fi + fi +msg_info "Updating ${APP} LXC" +npm update -g n8n &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5678${CL} \n" diff --git a/ct/navidrome.sh b/ct/navidrome.sh new file mode 100644 index 00000000..b9af1d6f --- /dev/null +++ b/ct/navidrome.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ __ _ __ + / | / /___ __ __(_)___/ /________ ____ ___ ___ + / |/ / __ / | / / / __ / ___/ __ \/ __ __ \/ _ \ + / /| / /_/ /| |/ / / /_/ / / / /_/ / / / / / / __/ +/_/ |_/\__,_/ |___/_/\__,_/_/ \____/_/ /_/ /_/\___/ + +EOF +} +header_info +echo -e "Loading..." +APP="Navidrome" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/navidrome ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +RELEASE=$(curl -s https://api.github.com/repos/navidrome/navidrome/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +msg_info "Stopping ${APP}" +systemctl stop navidrome.service +msg_ok "Stopped Navidrome" + +msg_info "Updating to v${RELEASE}" +wget https://github.com/navidrome/navidrome/releases/download/v${RELEASE}/navidrome_${RELEASE}_linux_amd64.tar.gz -O Navidrome.tar.gz &>/dev/null +tar -xvzf Navidrome.tar.gz -C /opt/navidrome/ &>/dev/null +msg_ok "Updated ${APP}" +rm Navidrome.tar.gz + +msg_info "${GN} Starting ${APP}" +systemctl start navidrome.service +msg_ok "Started ${APP}" +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:4533${CL} \n" diff --git a/ct/nextcloudpi.sh b/ct/nextcloudpi.sh new file mode 100644 index 00000000..7255de3d --- /dev/null +++ b/ct/nextcloudpi.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ __ __ ________ ______ _ + / | / /__ _ __/ /_/ ____/ /___ __ ______/ / __ \(_) + / |/ / _ \| |/_/ __/ / / / __ \/ / / / __ / /_/ / / + / /| / __/> /dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}https://${IP}/${CL} \n" diff --git a/ct/nginxproxymanager.sh b/ct/nginxproxymanager.sh new file mode 100644 index 00000000..75969716 --- /dev/null +++ b/ct/nginxproxymanager.sh @@ -0,0 +1,193 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + _ __ _ ____ __ ___ + / | / /___ _(_)___ _ __ / __ \_________ __ ____ __ / |/ /___ _____ ____ _____ ____ _____ + / |/ / __ / / __ \| |/_/ / /_/ / ___/ __ \| |/_/ / / / / /|_/ / __ / __ \/ __ / __ / _ \/ ___/ + / /| / /_/ / / / / /> < / ____/ / / /_/ /> /dev/null; then + msg_info "Installing pnpm" + export NODE_OPTIONS=--openssl-legacy-provider + npm install -g pnpm@8.15 &>/dev/null + msg_ok "Installed pnpm" + fi + RELEASE=$(curl -s https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest | + grep "tag_name" | + awk '{print substr($2, 3, length($2)-4) }') + msg_info "Stopping Services" + systemctl stop openresty + systemctl stop npm + msg_ok "Stopped Services" + + msg_info "Cleaning Old Files" + rm -rf /app \ + /var/www/html \ + /etc/nginx \ + /var/log/nginx \ + /var/lib/nginx \ + /var/cache/nginx &>/dev/null + msg_ok "Cleaned Old Files" + + msg_info "Downloading NPM v${RELEASE}" + wget -q https://codeload.github.com/NginxProxyManager/nginx-proxy-manager/tar.gz/v${RELEASE} -O - | tar -xz &>/dev/null + cd nginx-proxy-manager-${RELEASE} + msg_ok "Downloaded NPM v${RELEASE}" + + msg_info "Setting up Enviroment" + ln -sf /usr/bin/python3 /usr/bin/python + ln -sf /usr/bin/certbot /opt/certbot/bin/certbot + ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx + ln -sf /usr/local/openresty/nginx/ /etc/nginx + sed -i "s|\"version\": \"0.0.0\"|\"version\": \"$RELEASE\"|" backend/package.json + sed -i "s|\"version\": \"0.0.0\"|\"version\": \"$RELEASE\"|" frontend/package.json + sed -i 's|"fork-me": ".*"|"fork-me": "Proxmox VE Helper-Scripts"|' frontend/js/i18n/messages.json + sed -i "s|https://github.com.*source=nginx-proxy-manager|https://helper-scripts.com|g" frontend/js/app/ui/footer/main.ejs + sed -i 's+^daemon+#daemon+g' docker/rootfs/etc/nginx/nginx.conf + NGINX_CONFS=$(find "$(pwd)" -type f -name "*.conf") + for NGINX_CONF in $NGINX_CONFS; do + sed -i 's+include conf.d+include /etc/nginx/conf.d+g' "$NGINX_CONF" + done + mkdir -p /var/www/html /etc/nginx/logs + cp -r docker/rootfs/var/www/html/* /var/www/html/ + cp -r docker/rootfs/etc/nginx/* /etc/nginx/ + cp docker/rootfs/etc/letsencrypt.ini /etc/letsencrypt.ini + cp docker/rootfs/etc/logrotate.d/nginx-proxy-manager /etc/logrotate.d/nginx-proxy-manager + ln -sf /etc/nginx/nginx.conf /etc/nginx/conf/nginx.conf + rm -f /etc/nginx/conf.d/dev.conf + mkdir -p /tmp/nginx/body \ + /run/nginx \ + /data/nginx \ + /data/custom_ssl \ + /data/logs \ + /data/access \ + /data/nginx/default_host \ + /data/nginx/default_www \ + /data/nginx/proxy_host \ + /data/nginx/redirection_host \ + /data/nginx/stream \ + /data/nginx/dead_host \ + /data/nginx/temp \ + /var/lib/nginx/cache/public \ + /var/lib/nginx/cache/private \ + /var/cache/nginx/proxy_temp + chmod -R 777 /var/cache/nginx + chown root /tmp/nginx + echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf);" >/etc/nginx/conf.d/include/resolvers.conf + if [ ! -f /data/nginx/dummycert.pem ] || [ ! -f /data/nginx/dummykey.pem ]; then + openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -subj "/O=Nginx Proxy Manager/OU=Dummy Certificate/CN=localhost" -keyout /data/nginx/dummykey.pem -out /data/nginx/dummycert.pem &>/dev/null + fi + mkdir -p /app/global /app/frontend/images + cp -r backend/* /app + cp -r global/* /app/global + python3 -m pip install --no-cache-dir certbot-dns-cloudflare &>/dev/null + msg_ok "Setup Enviroment" + + msg_info "Building Frontend" + cd ./frontend + pnpm install &>/dev/null + pnpm upgrade &>/dev/null + pnpm run build &>/dev/null + cp -r dist/* /app/frontend + cp -r app-images/* /app/frontend/images + msg_ok "Built Frontend" + + msg_info "Initializing Backend" + rm -rf /app/config/default.json &>/dev/null + if [ ! -f /app/config/production.json ]; then + cat <<'EOF' >/app/config/production.json +{ + "database": { + "engine": "knex-native", + "knex": { + "client": "sqlite3", + "connection": { + "filename": "/data/database.sqlite" + } + } + } +} +EOF + fi + cd /app + pnpm install &>/dev/null + msg_ok "Initialized Backend" + + msg_info "Starting Services" + sed -i 's/user npm/user root/g; s/^pid/#pid/g' /usr/local/openresty/nginx/conf/nginx.conf + sed -i 's/include-system-site-packages = false/include-system-site-packages = true/g' /opt/certbot/pyvenv.cfg + systemctl enable -q --now openresty + systemctl enable -q --now npm + msg_ok "Started Services" + + msg_info "Cleaning up" + rm -rf ~/nginx-proxy-manager-* + msg_ok "Cleaned" + + msg_ok "Updated Successfully" + exit +} + +start +build_container +description + +msg_info "Setting Container to Normal Resources" +pct set $CTID -cores 1 +msg_ok "Set Container to Normal Resources" +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:81${CL}\n" diff --git a/ct/nocodb.sh b/ct/nocodb.sh new file mode 100644 index 00000000..4f8ff0b7 --- /dev/null +++ b/ct/nocodb.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ __ ____ ____ + / | / /___ ____ ___ / __ \/ __ ) + / |/ / __ \/ ___/ __ \/ / / / __ | + / /| / /_/ / /__/ /_/ / /_/ / /_/ / +/_/ |_/\____/\___/\____/_____/_____/ + +EOF +} +header_info +echo -e "Loading..." +APP="NocoDB" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/nocodb.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP}" +systemctl stop nocodb.service +cd /opt/nocodb +rm -rf nocodb +curl -s http://get.nocodb.com/linux-x64 -o nocodb -L +chmod +x nocodb +systemctl start nocodb.service +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8080/dashboard${CL} \n" diff --git a/ct/node-red.sh b/ct/node-red.sh new file mode 100644 index 00000000..1f68dc09 --- /dev/null +++ b/ct/node-red.sh @@ -0,0 +1,129 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ __ __ ____ __ + / | / /___ ____/ /__ / __ \___ ____/ / + / |/ / __ \/ __ / _ \ / /_/ / _ \/ __ / + / /| / /_/ / /_/ / __/ / _, _/ __/ /_/ / +/_/ |_/\____/\__,_/\___/ /_/ |_|\___/\__,_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Node-Red" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +if [[ ! -d /root/.node-red ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 2 \ + "1" "Update ${APP}" ON \ + "2" "Install Themes" OFF \ + 3>&1 1>&2 2>&3) +header_info +if [ "$UPD" == "1" ]; then + if [[ "$(node -v | cut -d 'v' -f 2)" == "18."* ]]; then + if ! command -v npm >/dev/null 2>&1; then + msg_info "Installing NPM" + apt-get install -y npm >/dev/null 2>&1 + msg_ok "Installed NPM" + fi + fi +msg_info "Stopping ${APP}" +systemctl stop nodered +msg_ok "Stopped ${APP}" + +msg_info "Updating ${APP}" +npm install -g --unsafe-perm node-red &>/dev/null +msg_ok "Updated ${APP}" + +msg_info "Starting ${APP}" +systemctl start nodered +msg_ok "Started ${APP}" +msg_ok "Update Successful" +exit +fi +if [ "$UPD" == "2" ]; then +THEME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "NODE-RED THEMES" --radiolist --cancel-button Exit-Script "Choose Theme" 15 58 6 \ + "aurora" "" OFF \ + "cobalt2" "" OFF \ + "dark" "" OFF \ + "dracula" "" OFF \ + "espresso-libre" "" OFF \ + "github-dark" "" OFF \ + "github-dark-default" "" OFF \ + "github-dark-dimmed" "" OFF \ + "midnight-red" "" ON \ + "monoindustrial" "" OFF \ + "monokai" "" OFF \ + "monokai-dimmed" "" OFF \ + "noctis" "" OFF \ + "oceanic-next" "" OFF \ + "oled" "" OFF \ + "one-dark-pro" "" OFF \ + "one-dark-pro-darker" "" OFF \ + "solarized-dark" "" OFF \ + "solarized-light" "" OFF \ + "tokyo-night" "" OFF \ + "tokyo-night-light" "" OFF \ + "tokyo-night-storm" "" OFF \ + "totallyinformation" "" OFF \ + "zenburn" "" OFF \ + 3>&1 1>&2 2>&3) +header_info +msg_info "Installing ${THEME} Theme" +cd /root/.node-red +sed -i 's|// theme: ".*",|theme: "",|g' /root/.node-red/settings.js +npm install @node-red-contrib-themes/theme-collection &>/dev/null +sed -i "{s/theme: ".*"/theme: '${THEME}',/g}" /root/.node-red/settings.js +systemctl restart nodered +msg_ok "Installed ${THEME} Theme" +exit +fi +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:1880${CL} \n" diff --git a/ct/notifiarr.sh b/ct/notifiarr.sh new file mode 100644 index 00000000..ac63e454 --- /dev/null +++ b/ct/notifiarr.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ __ __ _ _____ + / | / /___ / /_(_) __(_)___ ___________ + / |/ / __ \/ __/ / /_/ / __ `/ ___/ ___/ + / /| / /_/ / /_/ / __/ / /_/ / / / / +/_/ |_/\____/\__/_/_/ /_/\__,_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Notifiarr" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/apt/sources.list.d/golift.list ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5454${CL} \n" diff --git a/ct/ntfy.sh b/ct/ntfy.sh new file mode 100644 index 00000000..d12e4b3d --- /dev/null +++ b/ct/ntfy.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ____ + ____ / /_/ __/_ __ + / __ \/ __/ /_/ / / / + / / / / /_/ __/ /_/ / +/_/ /_/\__/_/ \__, / + /____/ + +EOF +} +header_info +echo -e "Loading..." +APP="ntfy" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}${CL} \n" diff --git a/ct/octoprint.sh b/ct/octoprint.sh new file mode 100644 index 00000000..75c2ccd9 --- /dev/null +++ b/ct/octoprint.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ ____ _ __ + / __ \_____/ /_____ / __ \_____(_)___ / /_ + / / / / ___/ __/ __ \/ /_/ / ___/ / __ \/ __/ +/ /_/ / /__/ /_/ /_/ / ____/ / / / / / / /_ +\____/\___/\__/\____/_/ /_/ /_/_/ /_/\__/ + +EOF +} +header_info +echo -e "Loading..." +APP="OctoPrint" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="0" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/octoprint ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Stopping OctoPrint" +systemctl stop octoprint +msg_ok "Stopped OctoPrint" + +msg_info "Updating OctoPrint" +source /opt/octoprint/bin/activate +pip3 install octoprint --upgrade &>/dev/null +msg_ok "Updated OctoPrint" + +msg_info "Starting OctoPrint" +systemctl start octoprint +msg_ok "Started OctoPrint" +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5000${CL} \n" diff --git a/ct/omada.sh b/ct/omada.sh new file mode 100644 index 00000000..5c637de8 --- /dev/null +++ b/ct/omada.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ + / __ \____ ___ ____ _____/ /___ _ + / / / / __ __ \/ __ / __ / __ / +/ /_/ / / / / / / /_/ / /_/ / /_/ / +\____/_/ /_/ /_/\__,_/\__,_/\__,_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Omada" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/tplink ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +latest_url=$(curl -fsSL "https://www.tp-link.com/en/support/download/omada-software-controller/" | grep -o 'https://.*x64.deb' | head -n1) +latest_version=$(basename "${latest_url}") +if [ -z "${latest_version}" ]; then + msg_error "It seems that the server (tp-link.com) might be down. Please try again at a later time." + exit +fi +echo -e "Updating Omada Controller" +wget -qL ${latest_url} +dpkg -i ${latest_version} +rm -rf ${latest_version} +echo -e "Updated Omada Controller" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}https://${IP}:8043${CL} \n" diff --git a/ct/ombi.sh b/ct/ombi.sh new file mode 100644 index 00000000..4e53aa6b --- /dev/null +++ b/ct/ombi.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ _ + / __ \____ ___ / /_ (_) + / / / / __ `__ \/ __ \/ / +/ /_/ / / / / / / /_/ / / +\____/_/ /_/ /_/_.___/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Ombi" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/ombi ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +RELEASE=$(curl -sL https://api.github.com/repos/Ombi-app/Ombi/releases/latest | grep '"tag_name":' | cut -d'"' -f4) +if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Stopping ${APP}" + systemctl stop ombi + msg_ok "Stopped ${APP}" + + msg_info "Updating ${APP} to ${RELEASE}" + wget -q https://github.com/Ombi-app/Ombi/releases/download/${RELEASE}/linux-x64.tar.gz + tar -xzf linux-x64.tar.gz -C /opt/ombi + rm -rf linux-x64.tar.gz + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated ${APP} to ${RELEASE}" + + msg_info "Starting ${APP}" + systemctl start ombi + msg_ok "Started ${APP}" + msg_ok "Updated Successfully" +else + msg_ok "No update required. ${APP} ia already at ${RELEASE}." +fi +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5000${CL} \n" diff --git a/ct/omv.sh b/ct/omv.sh new file mode 100644 index 00000000..525a35db --- /dev/null +++ b/ct/omv.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ ___ ___ _ __ ____ + / __ \____ ___ ____ / |/ /__ ____/ (_)___ | | / /___ ___ __/ / /_ + / / / / __ \/ _ \/ __ \/ /|_/ / _ \/ __ / / __ `/ | / / __ `/ / / / / __/ +/ /_/ / /_/ / __/ / / / / / / __/ /_/ / / /_/ /| |/ / /_/ / /_/ / / /_ +\____/ .___/\___/_/ /_/_/ /_/\___/\__,_/_/\__,_/ |___/\__,_/\__,_/_/\__/ + /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="OMV" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/apt/sources.list.d/openmediavault.list ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}${CL} \n" diff --git a/ct/openhab.sh b/ct/openhab.sh new file mode 100644 index 00000000..9546085a --- /dev/null +++ b/ct/openhab.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ _____ ____ + ____ ____ ___ ____ / / / / | / __ ) + / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __ | +/ /_/ / /_/ / __/ / / / __ / ___ |/ /_/ / +\____/ .___/\___/_/ /_/_/ /_/_/ |_/_____/ + /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="openHAB" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/apt/sources.list.d/openhab.list ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8080${CL} \n" diff --git a/ct/openobserve.sh b/ct/openobserve.sh new file mode 100644 index 00000000..cea4c29a --- /dev/null +++ b/ct/openobserve.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + + ____ ____ __ + / __ \____ ___ ____ / __ \/ /_ ________ ______ _____ + / / / / __ \/ _ \/ __ \/ / / / __ \/ ___/ _ \/ ___/ | / / _ \ +/ /_/ / /_/ / __/ / / / /_/ / /_/ (__ ) __/ / | |/ / __/ +\____/ .___/\___/_/ /_/\____/_.___/____/\___/_/ |___/\___/ + /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="OpenObserve" +var_disk="3" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/openobserve/ ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP" +systemctl stop openobserve +LATEST=$(curl -sL https://api.github.com/repos/openobserve/openobserve/releases/latest | grep '"tag_name":' | cut -d'"' -f4) +tar zxvf <(curl -fsSL https://github.com/openobserve/openobserve/releases/download/$LATEST/openobserve-${LATEST}-linux-amd64.tar.gz) -C /opt/openobserve +systemctl start openobserve +msg_ok "Updated $APP" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5080${CL} \n" diff --git a/ct/overseerr.sh b/ct/overseerr.sh new file mode 100644 index 00000000..a4a76bfc --- /dev/null +++ b/ct/overseerr.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ + / __ \_ _____ _____________ ___ __________ + / / / / | / / _ \/ ___/ ___/ _ \/ _ \/ ___/ ___/ +/ /_/ /| |/ / __/ / (__ ) __/ __/ / / / +\____/ |___/\___/_/ /____/\___/\___/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Overseerr" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/overseerr ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP" +systemctl stop overseerr +cd /opt/overseerr +output=$(git pull) +git pull &>/dev/null +if echo "$output" | grep -q "Already up to date." +then + msg_ok " $APP is already up to date." + systemctl start overseerr + exit +fi +yarn install &>/dev/null +yarn build &>/dev/null +systemctl start overseerr +msg_ok "Updated $APP" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5055${CL} \n" diff --git a/ct/owncast.sh b/ct/owncast.sh new file mode 100644 index 00000000..c06ccfbb --- /dev/null +++ b/ct/owncast.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ + / __ \_ ______ _________ ______/ /_ + / / / / | /| / / __ \/ ___/ __ `/ ___/ __/ +/ /_/ /| |/ |/ / / / / /__/ /_/ (__ ) /_ +\____/ |__/|__/_/ /_/\___/\__,_/____/\__/ + +EOF +} +header_info +echo -e "Loading..." +APP="Owncast" +var_disk="2" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/owncast ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8080${CL} + ${BL}http://${IP}:8080/admin${CL} admin|abc123\n" diff --git a/ct/pairdrop.sh b/ct/pairdrop.sh new file mode 100644 index 00000000..a1680a8c --- /dev/null +++ b/ct/pairdrop.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ _ ____ + / __ \____ _(_)____/ __ \_________ ____ + / /_/ / __ `/ / ___/ / / / ___/ __ \/ __ \ + / ____/ /_/ / / / / /_/ / / / /_/ / /_/ / +/_/ \__,_/_/_/ /_____/_/ \____/ .___/ + /_/ +EOF +} +header_info +echo -e "Loading..." +APP="PairDrop" +var_disk="4" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/pairdrop ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP" +systemctl stop pairdrop +cd /opt/pairdrop +git pull +npm install +systemctl start pairdrop +msg_ok "Updated $APP" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/paperless-ngx.sh b/ct/paperless-ngx.sh new file mode 100644 index 00000000..d23986b1 --- /dev/null +++ b/ct/paperless-ngx.sh @@ -0,0 +1,115 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + ____ __ + / __ \____ _____ ___ _____/ /__ __________ ____ ____ __ __ + / /_/ / __ `/ __ \/ _ \/ ___/ / _ \/ ___/ ___/___/ __ \/ __ `/ |/_/ + / ____/ /_/ / /_/ / __/ / / / __(__ |__ )___/ / / / /_/ /> < +/_/ \__,_/ .___/\___/_/ /_/\___/____/____/ /_/ /_/\__, /_/|_| + /_/ /____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Paperless-ngx" +var_disk="10" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + if [[ ! -d /opt/paperless ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/paperless-ngx/paperless-ngx/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + + UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 2 \ + "1" "Update Paperless-ngx to $RELEASE" ON \ + "2" "Paperless-ngx Credentials" OFF \ + 3>&1 1>&2 2>&3) + header_info + if [ "$UPD" == "1" ]; then + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Stopping all Paperless-ngx Services" + systemctl stop paperless-consumer paperless-webserver paperless-scheduler paperless-task-queue.service + msg_ok "Stopped all Paperless-ngx Services" + + msg_info "Updating to ${RELEASE}" + cd ~ + wget -q https://github.com/paperless-ngx/paperless-ngx/releases/download/$RELEASE/paperless-ngx-$RELEASE.tar.xz + tar -xf paperless-ngx-$RELEASE.tar.xz + cp -r /opt/paperless/paperless.conf paperless-ngx/ + cp -r paperless-ngx/* /opt/paperless/ + cd /opt/paperless + pip install -r requirements.txt &>/dev/null + cd /opt/paperless/src + /usr/bin/python3 manage.py migrate &>/dev/null + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated to ${RELEASE}" + + msg_info "Cleaning up" + cd ~ + rm paperless-ngx-$RELEASE.tar.xz + rm -rf paperless-ngx + msg_ok "Cleaned" + + msg_info "Starting all Paperless-ngx Services" + systemctl start paperless-consumer paperless-webserver paperless-scheduler paperless-task-queue.service + sleep 1 + msg_ok "Started all Paperless-ngx Services" + msg_ok "Updated Successfully!\n" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi + exit + fi + if [ "$UPD" == "2" ]; then + cat paperless.creds + exit + fi +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8000${CL} \n" diff --git a/ct/pbs.sh b/ct/pbs.sh new file mode 100644 index 00000000..97ffd5a4 --- /dev/null +++ b/ct/pbs.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash + +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ ____ __ _____ + / __ \_________ _ ______ ___ ____ _ __ / __ )____ ______/ /____ ______ / ___/___ ______ _____ _____ + / /_/ / ___/ __ \| |/_/ __ `__ \/ __ \| |/_/ / __ / __ `/ ___/ //_/ / / / __ \ \__ \/ _ \/ ___/ | / / _ \/ ___/ + / ____/ / / /_/ /> < / /_/ / /_/ / /__/ ,< / /_/ / /_/ / ___/ / __/ / | |/ / __/ / +/_/ /_/ \____/_/|_/_/ /_/ /_/\____/_/|_| /_____/\__,_/\___/_/|_|\__,_/ .___/ /____/\___/_/ |___/\___/_/ + /_/ +EOF +} +header_info +echo -e "Loading..." +APP="PBS" +var_disk="10" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8007${CL} \n" diff --git a/ct/peanut.sh b/ct/peanut.sh new file mode 100644 index 00000000..fb2975d7 --- /dev/null +++ b/ct/peanut.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: remz1337 +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ _ ____ ________ + / __ \___ ____ _/ | / / / / /_ __/ + / /_/ / _ \/ __ `/ |/ / / / / / / + / ____/ __/ /_/ / /| / /_/ / / / +/_/ \___/\__,_/_/ |_/\____/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="PeaNUT" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + header_info + if [[ ! -f /etc/systemd/system/peanut.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + RELEASE=$(curl -sL https://api.github.com/repos/Brandawg93/PeaNUT/releases/latest | grep '"tag_name":' | cut -d'"' -f4) + if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + msg_info "Updating $APP to ${RELEASE}" + systemctl stop peanut + wget -qO peanut.tar.gz https://api.github.com/repos/Brandawg93/PeaNUT/tarball/${RELEASE} + tar -xzf peanut.tar.gz -C /opt/peanut --strip-components 1 + rm peanut.tar.gz + cd /opt/peanut + pnpm i &>/dev/null + pnpm run build &>/dev/null + cp -r .next/static .next/standalone/.next/ + systemctl start peanut + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated $APP to ${RELEASE}" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi + exit +} + +start +build_container +description + +msg_info "Setting Container to Normal Resources" +pct set $CTID -memory 1024 +pct set $CTID -cores 1 +msg_ok "Set Container to Normal Resources" +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/petio.sh b/ct/petio.sh new file mode 100644 index 00000000..040b0c9b --- /dev/null +++ b/ct/petio.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ _ + / __ \___ / /_(_)___ + / /_/ / _ \/ __/ / __ \ + / ____/ __/ /_/ / /_/ / +/_/ \___/\__/_/\____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Petio" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="ubuntu" +var_version="20.04" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/Petio ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP" +systemctl stop petio.service +wget https://petio.tv/releases/latest -O petio-latest.zip +unzip petio-latest.zip -d /opt/Petio +systemctl start petio.service +msg_ok "Updated $APP" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:7777${CL} \n" diff --git a/ct/photoprism.sh b/ct/photoprism.sh new file mode 100644 index 00000000..593fe362 --- /dev/null +++ b/ct/photoprism.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + ____ __ ______ __________ ____ ____ _________ __ ___ + / __ \/ / / / __ \/_ __/ __ \/ __ \/ __ \/ _/ ___// |/ / + / /_/ / /_/ / / / / / / / / / / /_/ / /_/ // / \__ \/ /|_/ / + / ____/ __ / /_/ / / / / /_/ / ____/ _, _// / ___/ / / / / +/_/ /_/ /_/\____/ /_/ \____/_/ /_/ |_/___//____/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="PhotoPrism" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + header_info + if [[ ! -d /opt/photoprism ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + echo -e "\n ⚠️ Ensure you set 2vCPU & 3072MiB RAM MIMIMUM!!! \n" + msg_info "Stopping PhotoPrism" + sudo systemctl stop photoprism + msg_ok "Stopped PhotoPrism" + + msg_info "Updating PhotoPrism" + apt-get install -y libvips42 &>/dev/null + wget -q -cO - https://dl.photoprism.app/pkg/linux/amd64.tar.gz | tar -xzf - -C /opt/photoprism --strip-components=1 + msg_ok "Updated PhotoPrism" + + msg_info "Starting PhotoPrism" + sudo systemctl start photoprism + msg_ok "Started PhotoPrism" + msg_ok "Update Successful" + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:2342${CL} \n" diff --git a/ct/pialert.sh b/ct/pialert.sh new file mode 100644 index 00000000..7604d444 --- /dev/null +++ b/ct/pialert.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ _ ___ __ __ + / __ \(_) / | / /__ _____/ /_ + / /_/ / / / /| | / / _ \/ ___/ __/ + / ____/ / / ___ |/ / __/ / / /_ +/_/ /_(_)_/ |_/_/\___/_/ \__/ + +EOF +} +header_info +echo -e "Loading..." +APP="PiAlert" +var_disk="3" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/pialert ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +bash -c "$(wget -qLO - https://github.com/leiweibau/Pi.Alert/raw/main/install/pialert_update.sh)" -s --lxc +msg_ok "Updated $APP" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}/pialert/${CL} \n" diff --git a/ct/pihole.sh b/ct/pihole.sh new file mode 100644 index 00000000..bd66c313 --- /dev/null +++ b/ct/pihole.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ ____ __ ______ __ ______ + / __ \/ _/ / / / / __ \/ / / ____/ + / /_/ // /___/ /_/ / / / / / / __/ + / ____// /___/ __ / /_/ / /___/ /___ +/_/ /___/ /_/ /_/\____/_____/_____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Pihole" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /etc/pihole ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP}" +set +e +pihole -up +msg_ok "Updated ${APP}" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}/admin${CL} \n" diff --git a/ct/pingvin.sh b/ct/pingvin.sh new file mode 100644 index 00000000..0cce4f60 --- /dev/null +++ b/ct/pingvin.sh @@ -0,0 +1,88 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ _ _ _____ __ + / __ \(_)___ ____ __ __(_)___ / ___// /_ ____ _________ + / /_/ / / __ \/ __ `/ | / / / __ \ \__ \/ __ \/ __ `/ ___/ _ \ + / ____/ / / / / /_/ /| |/ / / / / / ___/ / / / / /_/ / / / __/ +/_/ /_/_/ /_/\__, / |___/_/_/ /_/ /____/_/ /_/\__,_/_/ \___/ + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Pingvin" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/pingvin-share ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Stopping Pingvin Share" +pm2 stop pingvin-share-backend pingvin-share-frontend &>/dev/null +msg_ok "Stopped Pingvin Share" + +msg_info "Updating Pingvin Share" +cd /opt/pingvin-share +git fetch --tags +git checkout $(git describe --tags `git rev-list --tags --max-count=1`) &>/dev/null +cd backend +npm install &>/dev/null +npm run build &>/dev/null +cd ../frontend +npm install &>/dev/null +npm run build &>/dev/null +msg_ok "Updated Pingvin Share" + +msg_info "Starting Pingvin Share" +pm2 start pingvin-share-backend pingvin-share-frontend &>/dev/null +msg_ok "Started Pingvin Share" + +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:3000 ${CL} \n" diff --git a/ct/plex.sh b/ct/plex.sh new file mode 100644 index 00000000..c112078e --- /dev/null +++ b/ct/plex.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ __ ___ ___ _____ + / __ \/ /__ _ __ / |/ /__ ____/ (_)___ _ / ___/___ ______ _____ _____ + / /_/ / / _ \| |/_/ / /|_/ / _ \/ __ / / __ `/ \__ \/ _ \/ ___/ | / / _ \/ ___/ + / ____/ / __/> < / / / / __/ /_/ / / /_/ / ___/ / __/ / | |/ / __/ / +/_/ /_/\___/_/|_| /_/ /_/\___/\__,_/_/\__,_/ /____/\___/_/ |___/\___/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Plex" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="ubuntu" +var_version="22.04" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +if [[ ! -f /etc/apt/sources.list.d/plexmediaserver.list ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select \nplexupdate info >> https://github.com/mrworf/plexupdate" 10 59 2 \ + "1" "Update LXC" ON \ + "2" "Install plexupdate" OFF \ + 3>&1 1>&2 2>&3) + +header_info +if [ "$UPD" == "1" ]; then +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated ${APP} LXC" +exit +fi +if [ "$UPD" == "2" ]; then +set +e +bash -c "$(wget -qO - https://raw.githubusercontent.com/mrworf/plexupdate/master/extras/installer.sh)" +exit +fi +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:32400/web${CL}\n" diff --git a/ct/pocketbase.sh b/ct/pocketbase.sh new file mode 100644 index 00000000..d7cae744 --- /dev/null +++ b/ct/pocketbase.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ __ __ + / __ \____ _____/ /_____ / /_/ /_ ____ _________ + / /_/ / __ \/ ___/ //_/ _ \/ __/ __ \/ __ `/ ___/ _ \ + / ____/ /_/ / /__/ ,< / __/ /_/ /_/ / /_/ (__ ) __/ +/_/ \____/\___/_/|_|\___/\__/_.___/\__,_/____/\___/ + +EOF +} +header_info +echo -e "Loading..." +APP="Pocketbase" +var_disk="8" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8080/_${CL}" diff --git a/ct/podman-homeassistant.sh b/ct/podman-homeassistant.sh new file mode 100644 index 00000000..1f02fe7f --- /dev/null +++ b/ct/podman-homeassistant.sh @@ -0,0 +1,143 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ + / __ \____ ____/ /___ ___ ____ _____ + / /_/ / __ \/ __ / __ __ \/ __ / __ \ + / ____/ /_/ / /_/ / / / / / / /_/ / / / / + __ __ /_/ \____/\__,_/_/ /_/ /_/\__,_/_/ /_/__ __ + / / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_ + / /_/ / __ \/ __ __ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ / __ \/ __/ + / __ / /_/ / / / / / / __/ / ___ |(__ |__ ) (__ ) /_/ /_/ / / / / /_ +/_/ /_/\____/_/ /_/ /_/\___/ /_/ |_/____/____/_/____/\__/\__,_/_/ /_/\__/ + +EOF +} +header_info +echo -e "Loading..." +APP="Podman-Home Assistant" +var_disk="16" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + if [[ ! -f /etc/systemd/system/homeassistant.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UPDATE" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 4 \ + "1" "Update system and containers" ON \ + "2" "Install HACS" OFF \ + "3" "Install FileBrowser" OFF \ + "4" "Remove ALL Unused Images" OFF \ + 3>&1 1>&2 2>&3) +header_info +if [ "$UPD" == "1" ]; then + msg_info "Updating ${APP} LXC" + apt-get update &>/dev/null + apt-get -y upgrade &>/dev/null + msg_ok "Updated Successfully" + + msg_info "Updating All Containers\n" + CONTAINER_LIST="${1:-$(podman ps -q)}" + for container in ${CONTAINER_LIST}; do + CONTAINER_IMAGE="$(podman inspect --format "{{.Config.Image}}" --type container ${container})" + RUNNING_IMAGE="$(podman inspect --format "{{.Image}}" --type container "${container}")" + podman pull "${CONTAINER_IMAGE}" + LATEST_IMAGE="$(podman inspect --format "{{.Id}}" --type image "${CONTAINER_IMAGE}")" + if [[ "${RUNNING_IMAGE}" != "${LATEST_IMAGE}" ]]; then + echo "Updating ${container} image ${CONTAINER_IMAGE}" + systemctl restart homeassistant + fi + done + msg_ok "All containers updated." + exit +fi +if [ "$UPD" == "2" ]; then + msg_info "Installing Home Assistant Community Store (HACS)" + apt update &>/dev/null + apt install unzip &>/dev/null + cd /var/lib/containers/storage/volumes/hass_config/_data + bash <(curl -fsSL https://get.hacs.xyz) &>/dev/null + msg_ok "Installed Home Assistant Community Store (HACS)" + echo -e "\n Reboot Home Assistant and clear browser cache then Add HACS integration.\n" + exit +fi +if [ "$UPD" == "3" ]; then + IP=$(hostname -I | awk '{print $1}') + msg_info "Installing FileBrowser" + curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash &>/dev/null + filebrowser config init -a '0.0.0.0' &>/dev/null + filebrowser config set -a '0.0.0.0' &>/dev/null + filebrowser users add admin changeme --perm.admin &>/dev/null + msg_ok "Installed FileBrowser" + + msg_info "Creating Service" + service_path="/etc/systemd/system/filebrowser.service" + echo "[Unit] + Description=Filebrowser + After=network-online.target + [Service] + User=root + WorkingDirectory=/root/ + ExecStart=/usr/local/bin/filebrowser -r / + [Install] + WantedBy=default.target" >$service_path + + systemctl enable --now filebrowser.service &>/dev/null + msg_ok "Created Service" + + msg_ok "Completed Successfully!\n" + echo -e "FileBrowser should be reachable by going to the following URL. + ${BL}http://$IP:8080${CL} admin|changeme\n" + exit +fi +if [ "$UPD" == "4" ]; then + msg_info "Removing ALL Unused Images" + podman image prune -a -f + msg_ok "Removed ALL Unused Images" + exit +fi + +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8123${CL} \n" diff --git a/ct/podman.sh b/ct/podman.sh new file mode 100644 index 00000000..e1e65b56 --- /dev/null +++ b/ct/podman.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ + / __ \____ ____/ /___ ___ ____ _____ + / /_/ / __ \/ __ / __ `__ \/ __ `/ __ \ + / ____/ /_/ / /_/ / / / / / / /_/ / / / / +/_/ \____/\__,_/_/ /_/ /_/\__,_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Podman" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/containers/registries.conf ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/postgresql.sh b/ct/postgresql.sh new file mode 100644 index 00000000..8ca8f172 --- /dev/null +++ b/ct/postgresql.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ _____ ____ __ + / __ \____ _____/ /_____ _________ / ___// __ \ / / + / /_/ / __ \/ ___/ __/ __ / ___/ _ \\__ \/ / / / / / + / ____/ /_/ (__ ) /_/ /_/ / / / __/__/ / /_/ / / /___ +/_/ \____/____/\__/\__, /_/ \___/____/\___\_\/_____/ + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="PostgreSQL" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/apt/sources.list.d/pgdg.list ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/prometheus.sh b/ct/prometheus.sh new file mode 100644 index 00000000..b2230eaa --- /dev/null +++ b/ct/prometheus.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ __ + / __ \_________ ____ ___ ___ / /_/ /_ ___ __ _______ + / /_/ / ___/ __ \/ __ __ \/ _ \/ __/ __ \/ _ \/ / / / ___/ + / ____/ / / /_/ / / / / / / __/ /_/ / / / __/ /_/ (__ ) +/_/ /_/ \____/_/ /_/ /_/\___/\__/_/ /_/\___/\__,_/____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Prometheus" +var_disk="4" +var_cpu="1" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/prometheus.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_error "There is currently no update path available." +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:9090${CL} \n" diff --git a/ct/prowlarr.sh b/ct/prowlarr.sh new file mode 100644 index 00000000..610928f8 --- /dev/null +++ b/ct/prowlarr.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ + / __ \_________ _ __/ /___ __________ + / /_/ / ___/ __ \ | /| / / / __ `/ ___/ ___/ + / ____/ / / /_/ / |/ |/ / / /_/ / / / / +/_/ /_/ \____/|__/|__/_/\__,_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Prowlarr" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var/lib/prowlarr/ ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_error "There is currently no update path available." +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:9696${CL} \n" diff --git a/ct/qbittorrent.sh b/ct/qbittorrent.sh new file mode 100644 index 00000000..0a8b1db8 --- /dev/null +++ b/ct/qbittorrent.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ _ __ __ __ + ____ _/ __ )(_) /_/ /_____ _____________ ____ / /_ + / __ `/ __ / / __/ __/ __ \/ ___/ ___/ _ \/ __ \/ __/ +/ /_/ / /_/ / / /_/ /_/ /_/ / / / / / __/ / / / /_ +\__, /_____/_/\__/\__/\____/_/ /_/ \___/_/ /_/\__/ + /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="qBittorrent" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/qbittorrent-nox.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated ${APP} LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8090${CL}\n" diff --git a/ct/rabbitmq.sh b/ct/rabbitmq.sh new file mode 100644 index 00000000..ff31111e --- /dev/null +++ b/ct/rabbitmq.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ __ _ __ __ _______ + / __ \____ _/ /_ / /_ (_) /_/ |/ / __ \ + / /_/ / __ `/ __ \/ __ \/ / __/ /|_/ / / / / + / _, _/ /_/ / /_/ / /_/ / / /_/ / / / /_/ / +/_/ |_|\__,_/_.___/_.___/_/\__/_/ /_/\___\_\ + +EOF +} +header_info +echo -e "Loading..." +APP="RabbitMQ" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + + +function update_script() { +header_info +if [[ ! -d /etc/rabbitmq ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +if (( $(df /boot | awk 'NR==2{gsub("%","",$5); print $5}') > 80 )); then + read -r -p "Warning: Storage is dangerously low, continue anyway? " prompt + [[ ${prompt,,} =~ ^(y|yes)$ ]] || exit +fi +msg_info "Stopping ${APP} Service" +systemctl stop rabbitmq-server +msg_ok "Stopped ${APP} Service" + +msg_info "Updating..." +apt install --only-upgrade rabbitmq-server &>/dev/null +msg_ok "Update Successfully" + +msg_info "Starting ${APP}" +systemctl start rabbitmq-server +msg_ok "Started ${APP}" +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:15672${CL} \n" diff --git a/ct/radarr.sh b/ct/radarr.sh new file mode 100644 index 00000000..69a75d62 --- /dev/null +++ b/ct/radarr.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ + / __ \____ _____/ /___ __________ + / /_/ / __ `/ __ / __ `/ ___/ ___/ + / _, _/ /_/ / /_/ / /_/ / / / / +/_/ |_|\__,_/\__,_/\__,_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Radarr" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var/lib/radarr/ ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:7878${CL} \n" diff --git a/ct/rdtclient.sh b/ct/rdtclient.sh new file mode 100755 index 00000000..7168998e --- /dev/null +++ b/ct/rdtclient.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ ____ __ _ __ ______ __ _________ __ + / __ \___ ____ / / / __ \___ / /_ _____(_)___/ / /_ __/___ _____________ ____ / /_ / ____/ (_)__ ____ / /_ + / /_/ / _ \/ __ `/ /___/ / / / _ \/ __ \/ ___/ / __ / / / / __ \/ ___/ ___/ _ \/ __ \/ __/ / / / / / _ \/ __ \/ __/ + / _, _/ __/ /_/ / /___/ /_/ / __/ /_/ / / / / /_/ / / / / /_/ / / / / / __/ / / / /_ / /___/ / / __/ / / / /_ +/_/ |_|\___/\__,_/_/ /_____/\___/_.___/_/ /_/\__,_/ /_/ \____/_/ /_/ \___/_/ /_/\__/ \____/_/_/\___/_/ /_/\__/ + +EOF +} +header_info +echo -e "Loading..." +APP="RDTClient" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/rdtc/ ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP" +systemctl stop rdtc +mkdir -p rdtc-backup +cp -R /opt/rdtc/appsettings.json rdtc-backup/ +wget -q https://github.com/rogerfar/rdt-client/releases/latest/download/RealDebridClient.zip +unzip -oqq RealDebridClient.zip -d /opt/rdtc +cp -R rdtc-backup/appsettings.json /opt/rdtc/ +rm -rf rdtc-backup RealDebridClient.zip +systemctl start rdtc +msg_ok "Updated $APP" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:6500${CL} \n" diff --git a/ct/readarr.sh b/ct/readarr.sh new file mode 100644 index 00000000..2e4494cf --- /dev/null +++ b/ct/readarr.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ + / __ \___ ____ _____/ /___ __________ + / /_/ / _ \/ __ `/ __ / __ `/ ___/ ___/ + / _, _/ __/ /_/ / /_/ / /_/ / / / / +/_/ |_|\___/\__,_/\__,_/\__,_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Readarr" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var/lib/readarr/ ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8787${CL} \n" diff --git a/ct/readeck.sh b/ct/readeck.sh new file mode 100644 index 00000000..cc5204ba --- /dev/null +++ b/ct/readeck.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ __ + / __ \___ ____ _____/ /__ _____/ /__ + / /_/ / _ \/ __ `/ __ / _ \/ ___/ //_/ + / _, _/ __/ /_/ / /_/ / __/ /__/ ,< +/_/ |_|\___/\__,_/\__,_/\___/\___/_/|_| + +EOF +} +header_info +echo -e "Loading..." +APP="Readeck" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/readeck ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP}" +LATEST=$(curl -s https://codeberg.org/readeck/readeck/releases/ | grep -oP '(?<=Version )\d+\.\d+\.\d+' | head -1) +systemctl stop readeck.service +rm -rf /opt/readeck/readeck +cd /opt/readeck +wget -q -O readeck https://codeberg.org/readeck/readeck/releases/download/${LATEST}/readeck-${LATEST}-linux-amd64 +chmod a+x readeck +systemctl start readeck.service +msg_ok "Updated ${APP}" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8000${CL}\n" diff --git a/ct/redis.sh b/ct/redis.sh new file mode 100644 index 00000000..c4621e20 --- /dev/null +++ b/ct/redis.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ ___ + / __ \___ ____/ (_)____ + / /_/ / _ \/ __ / / ___/ + / _, _/ __/ /_/ / (__ ) +/_/ |_|\___/\__,_/_/____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Redis" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +VERBOSE="yes" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /lib/systemd/system/redis-server.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_error "There is currently no update path available." +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/rockylinux.sh b/ct/rockylinux.sh new file mode 100644 index 00000000..8285e227 --- /dev/null +++ b/ct/rockylinux.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ __ _ + / __ \____ _____/ /____ __ / / (_)___ __ ___ __ + / /_/ / __ \/ ___/ //_/ / / / / / / / __ \/ / / / |/_/ + / _, _/ /_/ / /__/ ,< / /_/ / / /___/ / / / / /_/ /> < +/_/ |_|\____/\___/_/|_|\__, / /_____/_/_/ /_/\__,_/_/|_| + /____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Rocky Linux" +var_disk="1" +var_cpu="1" +var_ram="512" +var_os="rockylinux" +var_version="9" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="-password rockylinux" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /etc/pacman.d ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +dnf -y update +dnf -y upgrade +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/rtsptoweb.sh b/ct/rtsptoweb.sh new file mode 100644 index 00000000..56484a60 --- /dev/null +++ b/ct/rtsptoweb.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ ___________ ____ __ _ __ __ + / __ \/_ __/ ___// __ \/ /_____| | / /__ / /_ + / /_/ / / / \__ \/ /_/ / __/ __ \ | /| / / _ \/ __ \ + / _, _/ / / ___/ / ____/ /_/ /_/ / |/ |/ / __/ /_/ / +/_/ |_| /_/ /____/_/ \__/\____/|__/|__/\___/_.___/ + +EOF +} +header_info +echo -e "Loading..." +APP="RTSPtoWeb" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:8083 ${CL} \n" diff --git a/ct/runtipi.sh b/ct/runtipi.sh new file mode 100644 index 00000000..279230f3 --- /dev/null +++ b/ct/runtipi.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ __ _ _ + / __ \__ ______ / /_(_)___ (_) + / /_/ / / / / __ \/ __/ / __ \/ / + / _, _/ /_/ / / / / /_/ / /_/ / / +/_/ |_|\__,_/_/ /_/\__/_/ .___/_/ + /_/ +EOF +} +header_info +echo -e "Loading..." +APP="Runtipi" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/runtipi ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +cd /opt/runtipi && ./runtipi-cli update latest +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP} ${CL} \n" diff --git a/ct/sabnzbd.sh b/ct/sabnzbd.sh new file mode 100644 index 00000000..c6d0aa26 --- /dev/null +++ b/ct/sabnzbd.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _____ ___ ____ __ __ + / ___// | / __ )____ ____ / /_ ____/ / + \__ \/ /| | / __ / __ \/_ / / __ \/ __ / + ___/ / ___ |/ /_/ / / / / / /_/ /_/ / /_/ / +/____/_/ |_/_____/_/ /_/ /___/_.___/\__,_/ + +EOF +} +header_info +echo -e "Loading..." +APP="SABnzbd" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/sabnzbd ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP" +systemctl stop sabnzbd.service +RELEASE=$(curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +tar zxvf <(curl -fsSL https://github.com/sabnzbd/sabnzbd/releases/download/$RELEASE/SABnzbd-${RELEASE}-src.tar.gz) &>/dev/null +\cp -r SABnzbd-${RELEASE}/* /opt/sabnzbd &>/dev/null +rm -rf SABnzbd-${RELEASE} +cd /opt/sabnzbd +python3 -m pip install -r requirements.txt &>/dev/null +systemctl start sabnzbd.service +msg_ok "Updated $APP" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:7777${CL} \n" diff --git a/ct/scrypted.sh b/ct/scrypted.sh new file mode 100644 index 00000000..306ab620 --- /dev/null +++ b/ct/scrypted.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _____ __ __ + / ___/____________ ______ / /____ ____/ / + \__ \/ ___/ ___/ / / / __ \/ __/ _ \/ __ / + ___/ / /__/ / / /_/ / /_/ / /_/ __/ /_/ / +/____/\___/_/ \__, / .___/\__/\___/\__,_/ + /____/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Scrypted" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/scrypted.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}https://${IP}:10443${CL} \n" diff --git a/ct/sftpgo.sh b/ct/sftpgo.sh new file mode 100644 index 00000000..2354fe7d --- /dev/null +++ b/ct/sftpgo.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _____ ________________ ______ + / ___// ____/_ __/ __ \/ ____/___ + \__ \/ /_ / / / /_/ / / __/ __ \ + ___/ / __/ / / / ____/ /_/ / /_/ / +/____/_/ /_/ /_/ \____/\____/ + +EOF +} +header_info +echo -e "Loading..." +APP="SFTPGo" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8080/web/admin ${CL} \n" diff --git a/ct/shinobi.sh b/ct/shinobi.sh new file mode 100644 index 00000000..410f9433 --- /dev/null +++ b/ct/shinobi.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _____ __ _ __ _ + / ___// /_ (_)___ ____ / /_ (_) + \__ \/ __ \/ / __ \/ __ \/ __ \/ / + ___/ / / / / / / / / /_/ / /_/ / / +/____/_/ /_/_/_/ /_/\____/_.___/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Shinobi" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="ubuntu" +var_version="22.04" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="0" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/Shinobi ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating Shinobi LXC" +cd /opt/Shinobi +sh UPDATE.sh +pm2 flush +pm2 restart camera +pm2 restart cron +msg_ok "Updated Shinobi LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:8080/super${CL} \n" diff --git a/ct/smokeping.sh b/ct/smokeping.sh new file mode 100644 index 00000000..8da7d96c --- /dev/null +++ b/ct/smokeping.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _____ __ ____ _ + / ___/____ ___ ____ / /_____ / __ \(_)___ ____ _ + \__ \/ __ `__ \/ __ \/ //_/ _ \/ /_/ / / __ \/ __ `/ + ___/ / / / / / / /_/ / ,< / __/ ____/ / / / / /_/ / +/____/_/ /_/ /_/\____/_/|_|\___/_/ /_/_/ /_/\__, / + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="SmokePing" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if ! command -v smokeping &> /dev/null; then msg_error "No ${APP} Installation Found!"; exit; fi + +msg_info "Updating ${APP}" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}/smokeping${CL} \n" diff --git a/ct/sonarr.sh b/ct/sonarr.sh new file mode 100644 index 00000000..fe2c5939 --- /dev/null +++ b/ct/sonarr.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _____ + / ___/____ ____ ____ __________ + \__ \/ __ \/ __ \/ __ `/ ___/ ___/ + ___/ / /_/ / / / / /_/ / / / / +/____/\____/_/ /_/\__,_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Sonarr" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/Sonarr ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP v4" +systemctl stop sonarr.service +wget -q -O SonarrV4.tar.gz 'https://services.sonarr.tv/v1/download/main/latest?version=4&os=linux&arch=x64' +tar -xzf SonarrV4.tar.gz +rm -rf /opt/Sonarr +mv Sonarr /opt +rm -rf SonarrV4.tar.gz +systemctl start sonarr.service +msg_ok "Updated $APP v4" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8989${CL} \n" diff --git a/ct/spoolman.sh b/ct/spoolman.sh new file mode 100644 index 00000000..dadff3bf --- /dev/null +++ b/ct/spoolman.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _____ __ + / ___/____ ____ ____ / /___ ___ ____ _____ + \__ \/ __ \/ __ \/ __ \/ / __ `__ \/ __ `/ __ \ + ___/ / /_/ / /_/ / /_/ / / / / / / / /_/ / / / / +/____/ .___/\____/\____/_/_/ /_/ /_/\__,_/_/ /_/ + /_/ +EOF +} +header_info +echo -e "Loading..." +APP="Spoolman" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/spoolman ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +if (( $(df /boot | awk 'NR==2{gsub("%","",$5); print $5}') > 80 )); then + read -r -p "Warning: Storage is dangerously low, continue anyway? " prompt + [[ ${prompt,,} =~ ^(y|yes)$ ]] || exit +fi +RELEASE=$(wget -q https://github.com/Donkie/Spoolman/releases/latest -O - | grep "title>Release" | cut -d " " -f 4) +if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + + msg_info "Stopping ${APP} Service" + systemctl stop spoolman + msg_ok "Stopped ${APP} Service" + + msg_info "Updating ${APP} to ${RELEASE}" + cd /opt + rm -rf spoolman_bak + mv spoolman spoolman_bak + wget -q https://github.com/Donkie/Spoolman/releases/download/${RELEASE}/spoolman.zip + unzip -q spoolman.zip -d spoolman + cd spoolman + pip3 install -r requirements.txt >/dev/null 2>&1 + cp .env.example .env + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated ${APP} to ${RELEASE}" + + msg_info "Starting ${APP} Service" + systemctl start spoolman + msg_ok "Started ${APP} Service" + + msg_info "Cleaning up" + rm -rf /opt/spoolman.zip + msg_ok "Cleaned" + + msg_ok "Updated Successfully!\n" +else + msg_ok "No update required. ${APP} is already at ${RELEASE}" +fi +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:7912${CL} \n" diff --git a/ct/stirling-pdf.sh b/ct/stirling-pdf.sh new file mode 100644 index 00000000..f1505054 --- /dev/null +++ b/ct/stirling-pdf.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _____ __ _ ___ ____ ____ ______ + / ___// /_(_)____/ (_)___ ____ _ / __ \/ __ \/ ____/ + \__ \/ __/ / ___/ / / __ \/ __ `/___/ /_/ / / / / /_ + ___/ / /_/ / / / / / / / / /_/ /___/ ____/ /_/ / __/ +/____/\__/_/_/ /_/_/_/ /_/\__, / /_/ /_____/_/ + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Stirling-PDF" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/Stirling-PDF ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP}" +systemctl stop stirlingpdf +RELEASE=$(curl -s https://api.github.com/repos/Stirling-Tools/Stirling-PDF/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +wget -q https://github.com/Stirling-Tools/Stirling-PDF/archive/refs/tags/v$RELEASE.tar.gz +tar -xzf v$RELEASE.tar.gz +cd Stirling-PDF-$RELEASE +chmod +x ./gradlew +./gradlew build &>/dev/null +cp -r ./build/libs/Stirling-PDF-*.jar /opt/Stirling-PDF/ +cp -r scripts /opt/Stirling-PDF/ +cd ~ +rm -rf Stirling-PDF-$RELEASE v$RELEASE.tar.gz +ln -sf /opt/Stirling-PDF/Stirling-PDF-$RELEASE.jar /opt/Stirling-PDF/Stirling-PDF.jar +systemctl start stirlingpdf +msg_ok "Updated ${APP} to v$RELEASE" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8080 ${CL} \n" diff --git a/ct/syncthing.sh b/ct/syncthing.sh new file mode 100644 index 00000000..5cf7765c --- /dev/null +++ b/ct/syncthing.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _____ __ __ _ + / ___/__ ______ _____/ /_/ /_ (_)___ ____ _ + \__ \/ / / / __ \/ ___/ __/ __ \/ / __ \/ __ `/ + ___/ / /_/ / / / / /__/ /_/ / / / / / / / /_/ / +/____/\__, /_/ /_/\___/\__/_/ /_/_/_/ /_/\__, / + /____/ /____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Syncthing" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/apt/sources.list.d/syncthing.list ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8384 ${CL} \n" diff --git a/ct/tandoor.sh b/ct/tandoor.sh new file mode 100644 index 00000000..29085af5 --- /dev/null +++ b/ct/tandoor.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ __ ____ _ + /_ __/___ _____ ____/ /___ ____ _____ / __ \___ _____(_)___ ___ _____ + / / / __ `/ __ \/ __ / __ \/ __ \/ ___/ / /_/ / _ \/ ___/ / __ \/ _ \/ ___/ + / / / /_/ / / / / /_/ / /_/ / /_/ / / / _, _/ __/ /__/ / /_/ / __(__ ) +/_/ \__,_/_/ /_/\__,_/\____/\____/_/ /_/ |_|\___/\___/_/ .___/\___/____/ + /_/ +EOF +} +header_info +echo -e "Loading..." +APP="Tandoor" +var_disk="10" +var_cpu="4" +var_ram="4096" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + header_info + if [[ ! -d /opt/tandoor ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + if cd /opt/tandoor && git pull | grep -q 'Already up to date'; then + msg_ok "There is currently no update available." + else + msg_info "Updating ${APP} (Patience)" + export $(cat /opt/tandoor/.env | grep "^[^#]" | xargs) + cd /opt/tandoor/ + pip3 install -r requirements.txt >/dev/null 2>&1 + /usr/bin/python3 /opt/tandoor/manage.py migrate >/dev/null 2>&1 + /usr/bin/python3 /opt/tandoor/manage.py collectstatic --no-input >/dev/null 2>&1 + /usr/bin/python3 /opt/tandoor/manage.py collectstatic_js_reverse >/dev/null 2>&1 + cd /opt/tandoor/vue + yarn install >/dev/null 2>&1 + yarn build >/dev/null 2>&1 + systemctl restart gunicorn_tandoor + msg_ok "Updated ${APP}" + fi + exit +} + +start +build_container +description + +msg_info "Setting Container to Normal Resources" +pct set $CTID -memory 2048 +pct set $CTID -cores 2 +msg_ok "Set Container to Normal Resources" + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:8002${CL} \n" diff --git a/ct/tasmoadmin.sh b/ct/tasmoadmin.sh new file mode 100644 index 00000000..662c36f1 --- /dev/null +++ b/ct/tasmoadmin.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ ___ __ _ + /_ __/___ __________ ___ ____ / | ____/ /___ ___ (_)___ + / / / __ `/ ___/ __ `__ \/ __ \/ /| |/ __ / __ `__ \/ / __ \ + / / / /_/ (__ ) / / / / / /_/ / ___ / /_/ / / / / / / / / / / +/_/ \__,_/____/_/ /_/ /_/\____/_/ |_\__,_/_/ /_/ /_/_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="TasmoAdmin" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:9999${CL} \n" diff --git a/ct/tautulli.sh b/ct/tautulli.sh new file mode 100644 index 00000000..55a628d3 --- /dev/null +++ b/ct/tautulli.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ __ _____ + /_ __/___ ___ __/ /___ __/ / (_) + / / / __ `/ / / / __/ / / / / / / + / / / /_/ / /_/ / /_/ /_/ / / / / +/_/ \__,_/\__,_/\__/\__,_/_/_/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Tautulli" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/Tautulli/ ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8181${CL} \n" diff --git a/ct/tdarr.sh b/ct/tdarr.sh new file mode 100644 index 00000000..11bc2880 --- /dev/null +++ b/ct/tdarr.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ __ + /_ __/___/ /___ __________ + / / / __ / __ `/ ___/ ___/ + / / / /_/ / /_/ / / / / +/_/ \__,_/\__,_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Tdarr" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/tdarr ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8265${CL} \n" diff --git a/ct/technitiumdns.sh b/ct/technitiumdns.sh new file mode 100644 index 00000000..85775abd --- /dev/null +++ b/ct/technitiumdns.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ __ _ __ _ ____ _ _______ + /_ __/__ _____/ /_ ____ (_) /_(_)_ ______ ___ / __ \/ | / / ___/ + / / / _ \/ ___/ __ \/ __ \/ / __/ / / / / __ __ \ / / / / |/ /\__ \ + / / / __/ /__/ / / / / / / / /_/ / /_/ / / / / / / / /_/ / /| /___/ / +/_/ \___/\___/_/ /_/_/ /_/_/\__/_/\__,_/_/ /_/ /_/ /_____/_/ |_//____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Technitium DNS" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /etc/dns ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP}" + +if ! dpkg -s aspnetcore-runtime-8.0 > /dev/null 2>&1; then + wget -q https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb + dpkg -i packages-microsoft-prod.deb &>/dev/null + apt-get update &>/dev/null + apt-get install -y aspnetcore-runtime-8.0 &>/dev/null + rm packages-microsoft-prod.deb +fi +bash <(curl -fsSL https://download.technitium.com/dns/install.sh) &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5380${CL} \n" diff --git a/ct/threadfin.sh b/ct/threadfin.sh new file mode 100644 index 00000000..e870e26c --- /dev/null +++ b/ct/threadfin.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ________ _______ + /_ __/ /_ ________ ____ _____/ / __(_)___ + / / / __ \/ ___/ _ \/ __ `/ __ / /_/ / __ \ + / / / / / / / / __/ /_/ / /_/ / __/ / / / / +/_/ /_/ /_/_/ \___/\__,_/\__,_/_/ /_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Threadfin" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/threadfin ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP" +systemctl stop threadfin.service +wget -q -O /opt/threadfin/threadfin 'https://github.com/Threadfin/Threadfin/releases/latest/download/Threadfin_linux_amd64' +chmod +x /opt/threadfin/threadfin +systemctl start threadfin.service +msg_ok "Updated $APP" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:34400/web${CL} \n" diff --git a/ct/traccar.sh b/ct/traccar.sh new file mode 100644 index 00000000..1b62939a --- /dev/null +++ b/ct/traccar.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ + /_ __/________ _______________ ______ + / / / ___/ __ `/ ___/ ___/ __ `/ ___/ + / / / / / /_/ / /__/ /__/ /_/ / / +/_/ /_/ \__,_/\___/\___/\__,_/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Traccar" +var_disk="2" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/traccar ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_error "There is currently no update path available." +exit +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8082${CL} \n" diff --git a/ct/traefik.sh b/ct/traefik.sh new file mode 100644 index 00000000..0da650d1 --- /dev/null +++ b/ct/traefik.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ _____ __ + /_ __/________ ____ / __(_) /__ + / / / ___/ __ `/ _ \/ /_/ / //_/ + / / / / / /_/ / __/ __/ / ,< +/_/ /_/ \__,_/\___/_/ /_/_/|_| + +EOF +} +header_info +echo -e "Loading..." +APP="Traefik" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/traefik.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +RELEASE=3.0.4 #$(curl -s https://api.github.com/repos/traefik/traefik/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +msg_info "Updating $APP LXC" +if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + wget -q https://github.com/traefik/traefik/releases/download/v${RELEASE}/traefik_v${RELEASE}_linux_amd64.tar.gz + tar -C /tmp -xzf traefik*.tar.gz + mv /tmp/traefik /usr/bin/ + rm -rf traefik*.tar.gz + msg_ok "Updated $APP LXC" +else + msg_ok "No update required. ${APP} is already at ${RELEASE}" +fi +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8080${CL} \n" diff --git a/ct/transmission.sh b/ct/transmission.sh new file mode 100644 index 00000000..a7e234e4 --- /dev/null +++ b/ct/transmission.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ _ _ + /_ __/________ _____ _________ ___ (_)_________(_)___ ____ + / / / ___/ __ `/ __ \/ ___/ __ `__ \/ / ___/ ___/ / __ \/ __ \ + / / / / / /_/ / / / (__ ) / / / / / (__ |__ ) / /_/ / / / / +/_/ /_/ \__,_/_/ /_/____/_/ /_/ /_/_/____/____/_/\____/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Transmission" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/transmission-daemon/settings.json ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated ${APP} LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:9091/transmission${CL} \n" diff --git a/ct/trilium.sh b/ct/trilium.sh new file mode 100644 index 00000000..d4ade959 --- /dev/null +++ b/ct/trilium.sh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ _ ___ + /_ __/____(_) (_)_ ______ ___ + / / / ___/ / / / / / / __ `__ \ + / / / / / / / / /_/ / / / / / / +/_/ /_/ /_/_/_/\__,_/_/ /_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Trilium" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/trilium ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +RELEASE=$(curl -s https://api.github.com/repos/zadam/trilium/releases/latest | + grep "tag_name" | + awk '{print substr($2, 3, length($2)-4) }') + +msg_info "Stopping ${APP}" +systemctl stop trilium.service +sleep 1 +msg_ok "Stopped ${APP}" + +msg_info "Updating to v${RELEASE}" +wget -q https://github.com/zadam/trilium/releases/download/v$RELEASE/trilium-linux-x64-server-$RELEASE.tar.xz +tar -xvf trilium-linux-x64-server-$RELEASE.tar.xz &>/dev/null +cp -r trilium-linux-x64-server/* /opt/trilium/ +msg_ok "Updated to v${RELEASE}" + +msg_info "Cleaning up" +rm -rf trilium-linux-x64-server-$RELEASE.tar.xz trilium-linux-x64-server +msg_ok "Cleaned" + +msg_info "Starting ${APP}" +systemctl start trilium.service +sleep 1 +msg_ok "Started ${APP}" +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8080${CL} \n" diff --git a/ct/ubuntu.sh b/ct/ubuntu.sh new file mode 100644 index 00000000..448ca243 --- /dev/null +++ b/ct/ubuntu.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ ____ __ + / / / / /_ __ ______ / /___ __ + / / / / __ \/ / / / __ \/ __/ / / / +/ /_/ / /_/ / /_/ / / / / /_/ /_/ / +\____/_.___/\__,_/_/ /_/\__/\__,_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Ubuntu" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="ubuntu" +var_version="22.04" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated ${APP} LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/umami.sh b/ct/umami.sh new file mode 100644 index 00000000..065f4516 --- /dev/null +++ b/ct/umami.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ + __ ______ ___ ____ _____ ___ (_) + / / / / __ `__ \/ __ `/ __ `__ \/ / +/ /_/ / / / / / / /_/ / / / / / / / +\__,_/_/ /_/ /_/\__,_/_/ /_/ /_/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Umami" +var_disk="12" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/umami ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +if (( $(df /boot | awk 'NR==2{gsub("%","",$5); print $5}') > 80 )); then + read -r -p "Warning: Storage is dangerously low, continue anyway? " prompt + [[ ${prompt,,} =~ ^(y|yes)$ ]] || exit +fi + +msg_info "Stopping ${APP}" +systemctl stop umami +msg_ok "Stopped $APP" + +msg_info "Updating ${APP}" +cd /opt/umami +git pull +yarn install +yarn build +msg_ok "Updated ${APP}" + +msg_info "Starting ${APP}" +systemctl start umami +msg_ok "Started ${APP}" + +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_info "Setting Container to Normal Resources" +pct set $CTID -memory 1024 +pct set $CTID -cores 1 +msg_ok "Set Container to Normal Resources" +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/umbrel.sh b/ct/umbrel.sh new file mode 100644 index 00000000..62f9a471 --- /dev/null +++ b/ct/umbrel.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ __ __ + / / / /___ ___ / /_ ________ / / + / / / / __ `__ \/ __ \/ ___/ _ \/ / +/ /_/ / / / / / / /_/ / / / __/ / +\____/_/ /_/ /_/_.___/_/ \___/_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Umbrel" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated ${APP} LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL (reboot is required before apps install). + ${BL}http://${IP} ${CL} \n" diff --git a/ct/unifi.sh b/ct/unifi.sh new file mode 100644 index 00000000..cec984c5 --- /dev/null +++ b/ct/unifi.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ _ _____ + / / / /__ (_) __(_) + / / / / __ \/ / /_/ / +/ /_/ / / / / / __/ / +\____/_/ /_/_/_/ /_/ + +EOF +} +header_info +if ! grep -q -m1 'avx[^ ]*' /proc/cpuinfo; then + echo "AVX instruction set is not supported on this CPU." + exit +fi +echo -e "Loading..." +APP="Unifi" +var_disk="8" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /usr/lib/unifi ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP}" +apt-get update --allow-releaseinfo-change +apt-get install -y unifi +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP}${CL} should be reachable by going to the following URL. + ${BL}https://${IP}:8443${CL} \n" diff --git a/ct/unmanic.sh b/ct/unmanic.sh new file mode 100644 index 00000000..04134cee --- /dev/null +++ b/ct/unmanic.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ _ + / / / /___ ____ ___ ____ _____ (_)____ + / / / / __ \/ __ `__ \/ __ `/ __ \/ / ___/ +/ /_/ / / / / / / / / / /_/ / / / / / /__ +\____/_/ /_/_/ /_/ /_/\__,_/_/ /_/_/\___/ + +EOF +} +header_info +echo -e "Loading..." +APP="Unmanic" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="0" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/unmanic.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +pip3 install -U unmanic &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8888${CL} \n" diff --git a/ct/uptimekuma.sh b/ct/uptimekuma.sh new file mode 100644 index 00000000..17289c24 --- /dev/null +++ b/ct/uptimekuma.sh @@ -0,0 +1,96 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + __ __ __ _ __ __ + / / / /___ / /_(_)___ ___ ___ / //_/_ ______ ___ ____ _ + / / / / __ \/ __/ / __ __ \/ _ \ / ,< / / / / __ __ \/ __ / +/ /_/ / /_/ / /_/ / / / / / / __/ / /| / /_/ / / / / / / /_/ / +\____/ .___/\__/_/_/ /_/ /_/\___/ /_/ |_\__,_/_/ /_/ /_/\__,_/ + /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Uptime Kuma" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/uptime-kuma ]]; then msg_error "No ${APP} Installation Found!"; exit; fi + if [[ "$(node -v | cut -d 'v' -f 2)" == "18."* ]]; then + if ! command -v npm >/dev/null 2>&1; then + echo "Installing NPM..." + apt-get install -y npm >/dev/null 2>&1 + echo "Installed NPM..." + fi + fi +LATEST=$(curl -sL https://api.github.com/repos/louislam/uptime-kuma/releases/latest | grep '"tag_name":' | cut -d'"' -f4) +msg_info "Stopping ${APP}" +sudo systemctl stop uptime-kuma &>/dev/null +msg_ok "Stopped ${APP}" + +cd /opt/uptime-kuma + +msg_info "Pulling ${APP} ${LATEST}" +git fetch --all &>/dev/null +git checkout $LATEST --force &>/dev/null +msg_ok "Pulled ${APP} ${LATEST}" + +msg_info "Updating ${APP} to ${LATEST}" +npm install --production &>/dev/null +npm run download-dist &>/dev/null +msg_ok "Updated ${APP}" + +msg_info "Starting ${APP}" +sudo systemctl start uptime-kuma &>/dev/null +msg_ok "Started ${APP}" +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:3001${CL} \n" diff --git a/ct/vaultwarden.sh b/ct/vaultwarden.sh new file mode 100644 index 00000000..f7901b79 --- /dev/null +++ b/ct/vaultwarden.sh @@ -0,0 +1,150 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + _ __ ____ _ __ __ +| | / /___ ___ __/ / /| | / /___ __________/ /__ ____ +| | / / __ `/ / / / / __/ | /| / / __ `/ ___/ __ / _ \/ __ \ +| |/ / /_/ / /_/ / / /_ | |/ |/ / /_/ / / / /_/ / __/ / / / +|___/\__,_/\__,_/_/\__/ |__/|__/\__,_/_/ \__,_/\___/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Vaultwarden" +var_disk="6" +var_cpu="4" +var_ram="5120" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + if [[ ! -f /etc/systemd/system/vaultwarden.service ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + VAULT=$(curl -s https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest | + grep "tag_name" | + awk '{print substr($2, 2, length($2)-3) }') + WVRELEASE=$(curl -s https://api.github.com/repos/dani-garcia/bw_web_builds/releases/latest | + grep "tag_name" | + awk '{print substr($2, 2, length($2)-3) }') + + UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 3 \ + "1" "VaultWarden $VAULT" ON \ + "2" "Web-Vault $WVRELEASE" OFF \ + "3" "Set Admin Token" OFF \ + 3>&1 1>&2 2>&3) + + header_info + if [ "$UPD" == "1" ]; then + echo -e "\n ⚠️ Ensure you set 4vCPU & 4096MiB RAM minimum!!! \n" + msg_info "Stopping Vaultwarden" + systemctl stop vaultwarden.service + msg_ok "Stopped Vaultwarden" + + msg_info "Updating VaultWarden to $VAULT (Patience)" + cd ~ && rm -rf vaultwarden + git clone https://github.com/dani-garcia/vaultwarden &>/dev/null + cd vaultwarden + cargo build --features "sqlite,mysql,postgresql" --release &>/dev/null + DIR=/usr/bin/vaultwarden + if [ -d "$DIR" ]; then + cp target/release/vaultwarden /usr/bin/ + else + cp target/release/vaultwarden /opt/vaultwarden/bin/ + fi + msg_ok "Updated VaultWarden" + + msg_info "Cleaning up" + cd ~ && rm -rf vaultwarden + msg_ok "Cleaned" + + msg_info "Starting Vaultwarden" + systemctl start vaultwarden.service + msg_ok "Started Vaultwarden" + + msg_ok "$VAULT Update Successful" + echo -e "\n ⚠️ Ensure you set resources back to normal settings \n" + exit + fi + if [ "$UPD" == "2" ]; then + msg_info "Stopping Vaultwarden" + systemctl stop vaultwarden.service + msg_ok "Stopped Vaultwarden" + + msg_info "Updating Web-Vault to $WVRELEASE" + curl -fsSLO https://github.com/dani-garcia/bw_web_builds/releases/download/$WVRELEASE/bw_web_$WVRELEASE.tar.gz &>/dev/null + tar -zxf bw_web_$WVRELEASE.tar.gz -C /opt/vaultwarden/ &>/dev/null + msg_ok "Updated Web-Vault" + + msg_info "Cleaning up" + rm bw_web_$WVRELEASE.tar.gz + msg_ok "Cleaned" + + msg_info "Starting Vaultwarden" + systemctl start vaultwarden.service + msg_ok "Started Vaultwarden" + msg_ok "$WVRELEASE Update Successful" + exit + fi + if [ "$UPD" == "3" ]; then + if NEWTOKEN=$(whiptail --backtitle "Proxmox VE Helper Scripts" --passwordbox "Set the ADMIN_TOKEN" 10 58 3>&1 1>&2 2>&3); then + if [[ -z "$NEWTOKEN" ]]; then exit; fi + if ! command -v argon2 >/dev/null 2>&1; then apt-get install -y argon2 &>/dev/null; fi + TOKEN=$(echo -n ${NEWTOKEN} | argon2 "$(openssl rand -base64 32)" -t 2 -m 16 -p 4 -l 64 -e) + sed -i "s|ADMIN_TOKEN=.*|ADMIN_TOKEN='${TOKEN}'|" /opt/vaultwarden/.env + if [[ -f /opt/vaultwarden/data/config.json ]]; then + sed -i "s|\"admin_token\":.*|\"admin_token\": \"${TOKEN}\"|" /opt/vaultwarden/data/config.json + fi + systemctl restart vaultwarden + fi + exit + fi +} + +start +build_container +description + +msg_info "Setting Container to Normal Resources" +pct set $CTID -memory 512 +pct set $CTID -cores 1 +msg_ok "Set Container to Normal Resources" +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8000${CL} \n" diff --git a/ct/wastebin.sh b/ct/wastebin.sh new file mode 100644 index 00000000..be4b5aef --- /dev/null +++ b/ct/wastebin.sh @@ -0,0 +1,107 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +# Source: https://github.com/matze/wastebin + + +function header_info { +clear +cat <<"EOF" + _ __ __ __ _ +| | / /___ ______/ /____ / /_ (_)___ +| | /| / / __ `/ ___/ __/ _ \/ __ \/ / __ \ +| |/ |/ / /_/ (__ ) /_/ __/ /_/ / / / / / +|__/|__/\__,_/____/\__/\___/_.___/_/_/ /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Wastebin" +var_disk="4" +var_cpu="4" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/wastebin ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +if (( $(df /boot | awk 'NR==2{gsub("%","",$5); print $5}') > 80 )); then + read -r -p "Warning: Storage is dangerously low, continue anyway? " prompt + [[ ${prompt,,} =~ ^(y|yes)$ ]] || exit +fi +msg_info "Stopping Wastebin" +systemctl stop wastebin +msg_ok "Wastebin Stopped" + +msg_info "Updating Wastebin" +RELEASE=$(curl -s https://api.github.com/repos/matze/wastebin/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +cd /opt +if [ -d wastebin_bak ]; then + rm -rf wastebin_bak +fi +mv wastebin wastebin_bak +wget -q "https://github.com/matze/wastebin/archive/refs/tags/${RELEASE}.zip" +unzip -q ${RELEASE}.zip +mv wastebin-${RELEASE} /opt/wastebin +cd /opt/wastebin +cargo update -q +cargo build -q --release +msg_ok "Updated Wastebin" + +msg_info "Starting Wastebin" +systemctl start wastebin +msg_ok "Started Wastebin" + +msg_info "Cleaning Up" +cd /opt +rm -R ${RELEASE}.zip +rm -R wastebin_bak +msg_ok "Cleaned" +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_info "Setting Container to Normal Resources" +pct set $CTID -cores 2 +msg_ok "Set Container to Normal Resources" + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:8088${CL} \n" diff --git a/ct/watchyourlan.sh b/ct/watchyourlan.sh new file mode 100644 index 00000000..93eba4d1 --- /dev/null +++ b/ct/watchyourlan.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ __ __ ____ __ __ ___ _ __ +| | / /___ _/ /______/ /\ \/ /___ __ _______/ / / | / | / / +| | /| / / __ `/ __/ ___/ __ \ / __ \/ / / / ___/ / / /| | / |/ / +| |/ |/ / /_/ / /_/ /__/ / / / / /_/ / /_/ / / / /___/ ___ |/ /| / +|__/|__/\__,_/\__/\___/_/ /_/_/\____/\__,_/_/ /_____/_/ |_/_/ |_/ + +EOF +} +header_info +echo -e "Loading..." +APP="WatchYourLAN" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /lib/systemd/system/watchyourlan.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP" +systemctl stop watchyourlan.service +cp -R /data/config.yaml config.yaml +RELEASE=$(curl -s https://api.github.com/repos/aceberg/WatchYourLAN/releases/latest | grep -o '"tag_name": *"[^"]*"' | cut -d '"' -f 4) +wget -q https://github.com/aceberg/WatchYourLAN/releases/download/$RELEASE/watchyourlan_${RELEASE}_linux_amd64.deb +dpkg -i watchyourlan_${RELEASE}_linux_amd64.deb +cp -R config.yaml /data/config.yaml +sed -i 's|/etc/watchyourlan/config.yaml|/data/config.yaml|' /lib/systemd/system/watchyourlan.service +rm watchyourlan_${RELEASE}_linux_amd64.deb config.yaml +systemctl enable -q --now watchyourlan.service +msg_ok "Updated $APP" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8840${CL} \n" diff --git a/ct/whisparr.sh b/ct/whisparr.sh new file mode 100644 index 00000000..1a8b9a01 --- /dev/null +++ b/ct/whisparr.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ ____ _ +| | / / /_ (_)________ ____ __________ +| | /| / / __ \/ / ___/ __ \/ __ `/ ___/ ___/ +| |/ |/ / / / / (__ ) /_/ / /_/ / / / / +|__/|__/_/ /_/_/____/ .___/\__,_/_/ /_/ + /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Whisparr" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var/lib/whisparr ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:6969${CL} \n" diff --git a/ct/whoogle.sh b/ct/whoogle.sh new file mode 100644 index 00000000..5fa40ba2 --- /dev/null +++ b/ct/whoogle.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ ____ ______ ____ ________ ______ +| | / / / / / __ \/ __ \/ ____/ / / ____/ +| | /| / / /_/ / / / / / / / / __/ / / __/ +| |/ |/ / __ / /_/ / /_/ / /_/ / /___/ /___ +|__/|__/_/ /_/\____/\____/\____/_____/_____/ + +EOF +} +header_info +echo -e "Loading..." +APP="Whoogle" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /usr/local/bin/whoogle-search ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating ${APP} LXC" +pip3 install whoogle-search --upgrade &>/dev/null +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5000${CL} \n" diff --git a/ct/wikijs.sh b/ct/wikijs.sh new file mode 100644 index 00000000..dedff2d6 --- /dev/null +++ b/ct/wikijs.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ ___ __ _ _ +| | / (_) /__(_) (_)____ +| | /| / / / //_/ / / / ___/ +| |/ |/ / / ,< / / / (__ ) +|__/|__/_/_/|_/_(_)_/ /____/ + /___/ + +EOF +} +header_info +echo -e "Loading..." +APP="Wikijs" +var_disk="3" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /opt/wikijs ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Stopping ${APP}" +systemctl stop wikijs +msg_ok "Stopped ${APP}" + +msg_info "Backing up Data" +mkdir -p ~/data-backup +cp -R /opt/wikijs/{db.sqlite,config.yml,/data} ~/data-backup +msg_ok "Backed up Data" + +msg_info "Updating ${APP}" +rm -rf /opt/wikijs/* +cd /opt/wikijs +wget -q https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz +tar xzf wiki-js.tar.gz +msg_ok "Updated ${APP}" + +msg_info "Restoring Data" +cp -R ~/data-backup/* /opt/wikijs +rm -rf ~/data-backup +npm rebuild sqlite3 &>/dev/null +msg_ok "Restored Data" + +msg_info "Starting ${APP}" +systemctl start wikijs +msg_ok "Started ${APP}" +msg_ok "Updated Successfully" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/ct/wireguard.sh b/ct/wireguard.sh new file mode 100644 index 00000000..5feee4ac --- /dev/null +++ b/ct/wireguard.sh @@ -0,0 +1,126 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ ___ ______ __ +| | / (_)_______ / ____/_ ______ __________/ / +| | /| / / / ___/ _ \/ / __/ / / / __ `/ ___/ __ / +| |/ |/ / / / / __/ /_/ / /_/ / /_/ / / / /_/ / +|__/|__/_/_/ \___/\____/\__,_/\__,_/_/ \__,_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Wireguard" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="11" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +if [[ ! -d /etc/pivpn/wireguard ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 2 \ + "1" "Update ${APP} LXC" ON \ + "2" "Install WGDashboard" OFF \ + 3>&1 1>&2 2>&3) +header_info +if [ "$UPD" == "1" ]; then +msg_info "Updating ${APP} LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated ${APP} LXC" +exit +fi +if [ "$UPD" == "2" ]; then + if [[ -f /etc/systemd/system/wg-dashboard.service ]]; then + cd /etc/wgdashboard/src + chmod u+x wgd.sh + ./wgd.sh update + msg_ok "Updated Successfully" + exit + fi +IP=$(hostname -I | awk '{print $1}') +msg_info "Installing Python3-pip" +apt-get install -y python3-pip &>/dev/null +pip install flask &>/dev/null +pip install ifcfg &>/dev/null +pip install flask_qrcode &>/dev/null +pip install icmplib &>/dev/null +msg_ok "Installed Python3-pip" + +msg_info "Installing WGDashboard" +WGDREL=$(curl -s https://api.github.com/repos/donaldzou/WGDashboard/releases/latest | + grep "tag_name" | + awk '{print substr($2, 2, length($2)-3) }') + +git clone -b ${WGDREL} https://github.com/donaldzou/WGDashboard.git /etc/wgdashboard &>/dev/null +cd /etc/wgdashboard/src +chmod u+x wgd.sh +./wgd.sh install &>/dev/null +chmod -R 755 /etc/wireguard +msg_ok "Installed WGDashboard" + +msg_info "Creating Service" +service_path="/etc/systemd/system/wg-dashboard.service" +echo "[Unit] +After=systemd-networkd.service + +[Service] +WorkingDirectory=/etc/wgdashboard/src +ExecStart=/usr/bin/python3 /etc/wgdashboard/src/dashboard.py +Restart=always + + +[Install] +WantedBy=default.target" >$service_path +chmod 664 /etc/systemd/system/wg-dashboard.service +systemctl daemon-reload +systemctl enable wg-dashboard.service &>/dev/null +systemctl start wg-dashboard.service &>/dev/null +msg_ok "Created Service" +echo -e "WGDashboard should be reachable by going to the following URL. + ${BL}http://${IP}:10086${CL} admin|admin \n" +exit +fi +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/yunohost.sh b/ct/yunohost.sh new file mode 100644 index 00000000..613de2f5 --- /dev/null +++ b/ct/yunohost.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" +__ __ __ __ __ +\ \/ /_ ______ ____ / / / /___ _____/ /_ + \ / / / / __ \/ __ \/ /_/ / __ \/ ___/ __/ + / / /_/ / / / / /_/ / __ / /_/ (__ ) /_ +/_/\__,_/_/ /_/\____/_/ /_/\____/____/\__/ + +EOF +} +header_info +echo -e "Loading..." +APP="YunoHost" +var_disk="20" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="11" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/apt/trusted.gpg.d/php.gpg ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}/ ${CL}" diff --git a/ct/zabbix.sh b/ct/zabbix.sh new file mode 100644 index 00000000..3eb578d0 --- /dev/null +++ b/ct/zabbix.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _____ __ __ _ +/__ / ____ _/ /_ / /_ (_) __ + / / / __ `/ __ \/ __ \/ / |/_/ + / /__/ /_/ / /_/ / /_/ / /> < +/____/\__,_/_.___/_.___/_/_/|_| + +EOF +} +header_info +echo -e "Loading..." +APP="Zabbix" +var_disk="6" +var_cpu="2" +var_ram="4096" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/zabbix/zabbix_server.conf ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}/zabbix${CL} \n" diff --git a/ct/zigbee2mqtt.sh b/ct/zigbee2mqtt.sh new file mode 100644 index 00000000..e3ae7ee8 --- /dev/null +++ b/ct/zigbee2mqtt.sh @@ -0,0 +1,154 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + _____ _ __ ___ __ _______ ____________ +/__ / (_)___ _/ /_ ___ ___ |__ \ / |/ / __ \/_ __/_ __/ + / / / / __ / __ \/ _ \/ _ \__/ // /|_/ / / / / / / / / + / /__/ / /_/ / /_/ / __/ __/ __// / / / /_/ / / / / / +/____/_/\__, /_.___/\___/\___/____/_/ /_/\___\_\/_/ /_/ + /____/ 🐝 + +EOF +} +header_info +echo -e "Loading..." +APP="Zigbee2MQTT" +var_disk="4" +var_cpu="2" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="0" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + header_info + if [[ ! -d /opt/zigbee2mqtt ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + if [[ "$(node -v | cut -d 'v' -f 2)" == "18."* ]]; then + if ! command -v npm >/dev/null 2>&1; then + echo "Installing NPM..." + apt-get install -y npm >/dev/null 2>&1 + echo "Installed NPM..." + fi + fi + cd /opt/zigbee2mqtt + + stop_zigbee2mqtt() { + if which systemctl 2>/dev/null >/dev/null; then + echo "Shutting down Zigbee2MQTT..." + sudo systemctl stop zigbee2mqtt + else + echo "Skipped stopping Zigbee2MQTT, no systemctl found" + fi + } + + start_zigbee2mqtt() { + if which systemctl 2>/dev/null >/dev/null; then + echo "Starting Zigbee2MQTT..." + sudo systemctl start zigbee2mqtt + else + echo "Skipped starting Zigbee2MQTT, no systemctl found" + fi + } + + set -e + + if [ -d data-backup ]; then + echo "ERROR: Backup directory exists. May be previous restoring was failed?" + echo "1. Save 'data-backup' and 'data' dirs to safe location to make possibility to restore config later." + echo "2. Manually delete 'data-backup' dir and try again." + exit 1 + fi + + stop_zigbee2mqtt + + echo "Generating a backup of the configuration..." + cp -R data data-backup || { + echo "Failed to create backup." + exit 1 + } + + echo "Checking if any changes were made to package-lock.json..." + git checkout package-lock.json || { + echo "Failed to check package-lock.json." + exit 1 + } + + echo "Initiating update..." + if ! git pull; then + echo "Update failed, temporarily storing changes and trying again." + git stash && git pull || ( + echo "Update failed even after storing changes. Aborting." + exit 1 + ) + fi + + echo "Acquiring necessary components..." + npm ci || { + echo "Failed to install necessary components." + exit 1 + } + + echo "Building..." + npm run build || { + echo "Failed to build new version." + exit 1 + } + + echo "Restoring configuration..." + cp -R data-backup/* data || { + echo "Failed to restore configuration." + exit 1 + } + + rm -rf data-backup || { + echo "Failed to remove backup directory." + exit 1 + } + + start_zigbee2mqtt + + echo "Done!" + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" diff --git a/ct/zoraxy.sh b/ct/zoraxy.sh new file mode 100644 index 00000000..84a40785 --- /dev/null +++ b/ct/zoraxy.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _____ +/__ / ____ _________ __ ____ __ + / / / __ \/ ___/ __ `/ |/_/ / / / + / /__/ /_/ / / / /_/ /> /dev/null + unzip zwave-js-ui-${RELEASE}-linux.zip &>/dev/null + \cp -R zwave-js-ui-linux /opt/zwave-js-ui + service_path="/etc/systemd/system/zwave-js-ui.service" + echo "[Unit] + Description=zwave-js-ui + Wants=network-online.target + After=network-online.target + [Service] + User=root + WorkingDirectory=/opt/zwave-js-ui + ExecStart=/opt/zwave-js-ui/zwave-js-ui-linux + [Install] + WantedBy=multi-user.target" >$service_path + msg_ok "Updated Z-wave JS UI" + + msg_info "Starting Z-wave JS UI" + systemctl enable --now zwave-js-ui.service + msg_ok "Started Z-wave JS UI" + + msg_info "Cleanup" + rm -rf zwave-js-ui-${RELEASE}-linux.zip zwave-js-ui-linux store + msg_ok "Cleaned" + msg_ok "Updated Successfully!\n" + exit +} + +start +build_container +description + +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8091${CL} \n" diff --git a/install/actualbudget-install.sh b/install/actualbudget-install.sh new file mode 100644 index 00000000..fbd07867 --- /dev/null +++ b/install/actualbudget-install.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +$STD apt-get install -y git +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +$STD npm install --global yarn +msg_ok "Installed Node.js" + +msg_info "Installing Actual Budget" +$STD git clone https://github.com/actualbudget/actual-server.git /opt/actualbudget +cd /opt/actualbudget +$STD yarn install +msg_ok "Installed Actual Budget" + +msg_info "Creating Service" +cat </etc/systemd/system/actualbudget.service +[Unit] +Description=Actual Budget Service +After=network.target + +[Service] +Type=exec +WorkingDirectory=/opt/actualbudget +ExecStart=/usr/bin/yarn start + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now actualbudget.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/adguard-install.sh b/install/adguard-install.sh new file mode 100644 index 00000000..ef3688cf --- /dev/null +++ b/install/adguard-install.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing AdGuard Home" +$STD tar zxvf <(curl -fsSL https://static.adtidy.org/adguardhome/release/AdGuardHome_linux_amd64.tar.gz) -C /opt +msg_ok "Installed AdGuard Home" + +msg_info "Creating Service" +cat </etc/systemd/system/AdGuardHome.service +[Unit] +Description=AdGuard Home: Network-level blocker +ConditionFileIsExecutable=/opt/AdGuardHome/AdGuardHome +After=syslog.target network-online.target + +[Service] +StartLimitInterval=5 +StartLimitBurst=10 +ExecStart=/opt/AdGuardHome/AdGuardHome "-s" "run" +WorkingDirectory=/opt/AdGuardHome +StandardOutput=file:/var/log/AdGuardHome.out +StandardError=file:/var/log/AdGuardHome.err +Restart=always +RestartSec=10 +EnvironmentFile=-/etc/sysconfig/AdGuardHome + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now AdGuardHome.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/agentdvr-install.sh b/install/agentdvr-install.sh new file mode 100644 index 00000000..f0c431a0 --- /dev/null +++ b/install/agentdvr-install.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y unzip +$STD apt-get install -y apt-transport-https +$STD apt-get install -y alsa-utils +$STD apt-get install -y libxext-dev +$STD apt-get install -y fontconfig +$STD apt-get install -y libva-drm2 +msg_ok "Installed Dependencies" + +msg_info "Installing AgentDVR" +mkdir -p /opt/agentdvr/agent +RELEASE=$(curl -s "https://www.ispyconnect.com/api/Agent/DownloadLocation4?platform=Linux64&fromVersion=0" | grep -o 'https://.*\.zip') +cd /opt/agentdvr/agent +wget -q $RELEASE +$STD unzip Agent_Linux64*.zip +rm -rf Agent_Linux64*.zip +chmod +x ./Agent +msg_ok "Installed AgentDVR" + +msg_info "Creating Service" +cat </etc/systemd/system/AgentDVR.service +[Unit] +Description=AgentDVR + +[Service] +WorkingDirectory=/opt/agentdvr/agent +ExecStart=/opt/agentdvr/agent/./Agent +Environment="MALLOC_TRIM_THRESHOLD_=100000" +SyslogIdentifier=AgentDVR +Restart=always +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now AgentDVR.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/alpine-docker-install.sh b/install/alpine-docker-install.sh new file mode 100644 index 00000000..58431201 --- /dev/null +++ b/install/alpine-docker-install.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" + +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apk add newt +$STD apk add curl +$STD apk add openssh +$STD apk add tzdata +$STD apk add nano +$STD apk add mc +msg_ok "Installed Dependencies" + +msg_info "Installing Docker" +$STD apk add docker +$STD rc-service docker start +$STD rc-update add docker default +msg_ok "Installed Docker" + +get_latest_release() { + curl -sL https://api.github.com/repos/$1/releases/latest | grep '"tag_name":' | cut -d'"' -f4 +} +PORTAINER_LATEST_VERSION=$(get_latest_release "portainer/portainer") +DOCKER_COMPOSE_LATEST_VERSION=$(get_latest_release "docker/compose") +PORTAINER_AGENT_LATEST_VERSION=$(get_latest_release "portainer/agent") + +read -r -p "Would you like to add Portainer? " prompt +if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + msg_info "Installing Portainer $PORTAINER_LATEST_VERSION" + docker volume create portainer_data >/dev/null + $STD docker run -d \ + -p 8000:8000 \ + -p 9443:9443 \ + --name=portainer \ + --restart=always \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v portainer_data:/data \ + portainer/portainer-ce:latest + msg_ok "Installed Portainer $PORTAINER_LATEST_VERSION" +else + read -r -p "Would you like to add the Portainer Agent? " prompt + if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + msg_info "Installing Portainer agent $PORTAINER_AGENT_LATEST_VERSION" + $STD docker run -d \ + -p 9001:9001 \ + --name portainer_agent \ + --restart=always \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v /var/lib/docker/volumes:/var/lib/docker/volumes \ + portainer/agent + msg_ok "Installed Portainer Agent $PORTAINER_AGENT_LATEST_VERSION" + fi +fi +read -r -p "Would you like to add Docker Compose? " prompt +if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + msg_info "Installing Docker Compose $DOCKER_COMPOSE_LATEST_VERSION" + DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} + mkdir -p $DOCKER_CONFIG/cli-plugins + curl -sSL https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_LATEST_VERSION/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose + chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose + msg_ok "Installed Docker Compose $DOCKER_COMPOSE_LATEST_VERSION" +fi + +motd_ssh +customize diff --git a/install/alpine-grafana-install.sh b/install/alpine-grafana-install.sh new file mode 100644 index 00000000..7d7e95ad --- /dev/null +++ b/install/alpine-grafana-install.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" + +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apk add newt +$STD apk add curl +$STD apk add openssh +$STD apk add nano +$STD apk add mc +msg_ok "Installed Dependencies" + +msg_info "Installing Grafana" +$STD apk add grafana +$STD sed -i '/http_addr/s/127.0.0.1/0.0.0.0/g' /etc/conf.d/grafana +$STD rc-service grafana start +$STD rc-update add grafana default +msg_ok "Installed Grafana" + +motd_ssh +customize \ No newline at end of file diff --git a/install/alpine-install.sh b/install/alpine-install.sh new file mode 100644 index 00000000..b904c7a4 --- /dev/null +++ b/install/alpine-install.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" + +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apk add newt +$STD apk add curl +$STD apk add openssh +$STD apk add nano +$STD apk add mc +msg_ok "Installed Dependencies" + +motd_ssh +customize diff --git a/install/alpine-nextcloud-install.sh b/install/alpine-nextcloud-install.sh new file mode 100644 index 00000000..9b320546 --- /dev/null +++ b/install/alpine-nextcloud-install.sh @@ -0,0 +1,191 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" + +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apk add newt +$STD apk add curl +$STD apk add openssl +$STD apk add openssh +$STD apk add nano +$STD apk add mc +$STD apk add nginx +msg_ok "Installed Dependencies" + +msg_info "Installing PHP/Redis" +$STD apk add php82-opcache +$STD apk add php82-redis +$STD apk add php82-apcu +$STD apk add php82-fpm +$STD apk add php82-sysvsem +$STD apk add php82-ftp +$STD apk add php82-pecl-smbclient +$STD apk add php82-pecl-imagick +$STD apk add php82-pecl-vips +$STD apk add php82-exif +$STD apk add php82-sodium +$STD apk add php82-bz2 +$STD apk add redis +msg_ok "Installed PHP/Redis" + +msg_info "Installing MySQL Database" +DB_NAME=nextcloud +DB_USER=nextcloud +DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" +ADMIN_PASS="$(openssl rand -base64 18 | cut -c1-13)" +echo "" >>~/nextcloud.creds +echo -e "MySQL Admin Password: \e[32m$ADMIN_PASS\e[0m" >>~/nextcloud.creds +echo -e "Nextcloud Database Username: \e[32m$DB_USER\e[0m" >>~/nextcloud.creds +echo -e "Nextcloud Database Password: \e[32m$DB_PASS\e[0m" >>~/nextcloud.creds +echo -e "Nextcloud Database Name: \e[32m$DB_NAME\e[0m" >>~/nextcloud.creds +$STD apk add nextcloud-mysql mariadb mariadb-client +$STD mysql_install_db --user=mysql --datadir=/var/lib/mysql +$STD service mariadb start +$STD rc-update add mariadb +mysql -uroot -p"$ADMIN_PASS" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '$ADMIN_PASS' WITH GRANT OPTION; DELETE FROM mysql.user WHERE User=''; DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1'); DROP DATABASE test; DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%'; CREATE DATABASE $DB_NAME; GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS'; GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost.localdomain' IDENTIFIED BY '$DB_PASS'; FLUSH PRIVILEGES;" +$STD apk del mariadb-client +msg_ok "Installed MySQL Database" + +msg_info "Installing Nextcloud" +ADMIN_USER=ncAdmin +echo "" >>~/nextcloud.creds +echo -e "Nextcloud Admin Username: \e[32m$ADMIN_USER\e[0m" >>~/nextcloud.creds +echo -e "Nextcloud Admin Password: \e[32m$ADMIN_PASS\e[0m (Initially enter twice)" >>~/nextcloud.creds +$STD apk add nextcloud-initscript +$STD openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout /etc/ssl/private/nextcloud-selfsigned.key -out /etc/ssl/certs/nextcloud-selfsigned.crt -subj "/C=US/O=Nextcloud/OU=Domain Control Validated/CN=nextcloud.local" +cat <<'EOF' >/usr/share/webapps/nextcloud/config/config.php + '/var/lib/nextcloud/data', + 'logfile' => '/var/log/nextcloud/nextcloud.log', + 'logdateformat' => 'F d, Y H:i:s', + 'log_rotate_size' => 104857600, + 'apps_paths' => array ( + 0 => array ( + 'path' => '/usr/share/webapps/nextcloud/apps', + 'url' => '/apps', + 'writable' => false, + ), + 1 => array ( + 'path' => '/var/lib/nextcloud/apps', + 'url' => '/apps-appstore', + 'writable' => true, + ), + ), + 'updatechecker' => false, + 'check_for_working_htaccess' => false, + 'memcache.local' => '\\OC\\Memcache\\Redis', + 'memcache.locking' => '\\OC\\Memcache\\Redis', + 'redis' => array( + 'host' => 'localhost', + 'port' => 6379, + 'dbindex' => 0, + 'timeout' => 1.5, + ), + 'installed' => false, +); +EOF +rm -rf /etc/nginx/http.d/default.conf +cat <<'EOF' >/etc/nginx/http.d/nextcloud.conf +server { + listen [::]:80; + listen 80; + return 301 https://$host$request_uri; + server_name localhost; +} +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name localhost; + root /usr/share/webapps/nextcloud; + index index.php index.html index.htm; + disable_symlinks off; + ssl_certificate /etc/ssl/certs/nextcloud-selfsigned.crt; + ssl_certificate_key /etc/ssl/private/nextcloud-selfsigned.key; + ssl_session_timeout 5m; + ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA; + ssl_prefer_server_ciphers on; + location / { + try_files $uri $uri/ /index.html; + } + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + if (!-f $document_root$fastcgi_script_name) { + return 404; + } + fastcgi_pass unix:/run/nextcloud/fastcgi.sock; # From the nextcloud-initscript package + fastcgi_index index.php; + include fastcgi.conf; + } + location ^~ /.well-known/carddav { return 301 /remote.php/dav/; } + location ^~ /.well-known/caldav { return 301 /remote.php/dav/; } + location ^~ /.well-known/webfinger { return 301 /index.php/.well-known/webfinger; } + location ^~ /.well-known/nodeinfo { return 301 /index.php/.well-known/nodeinfo; } +} +EOF +sed -i -e 's|memory_limit = 128M|memory_limit = 512M|; $aapc.enable_cli=1' /etc/php82/php.ini +sed -i -E '/^php_admin_(flag|value)\[opcache/s/^/;/' /etc/php82/php-fpm.d/nextcloud.conf +msg_ok "Installed Nextcloud" + +msg_info "Adding Additional Nextcloud Packages" +$STD apk add nextcloud-default-apps +$STD apk add nextcloud-activity +$STD apk add nextcloud-admin_audit +$STD apk add nextcloud-comments +$STD apk add nextcloud-dashboard +$STD apk add nextcloud-doc +$STD apk add nextcloud-encryption +$STD apk add nextcloud-federation +$STD apk add nextcloud-files_external +$STD apk add nextcloud-files_sharing +$STD apk add nextcloud-files_trashbin +$STD apk add nextcloud-files_versions +$STD apk add nextcloud-notifications +$STD apk add nextcloud-sharebymail +$STD apk add nextcloud-suspicious_login +$STD apk add nextcloud-support +$STD apk add nextcloud-systemtags +$STD apk add nextcloud-user_status +$STD apk add nextcloud-weather_status +msg_ok "Added Additional Nextcloud Packages" + +msg_info "Starting Services" +$STD rc-service redis start +$STD rc-update add redis default +$STD rc-service php-fpm82 start +chown -R nextcloud:www-data /var/log/nextcloud/ +$STD rc-service php-fpm82 restart +$STD rc-service nginx start +$STD rc-service nextcloud start +$STD rc-update add nginx default +$STD rc-update add nextcloud default +msg_ok "Started Services" + +msg_info "Start Nextcloud Setup-Wizard" +echo -e "export VISUAL=nano\nexport EDITOR=nano" >>/etc/profile +cd /usr/share/webapps/nextcloud +$STD su nextcloud -s /bin/sh -c "php82 occ maintenance:install \ +--database='mysql' --database-name $DB_NAME \ +--database-user '$DB_USER' --database-pass '$DB_PASS' \ +--admin-user '$ADMIN_USER' --admin-pass '$ADMIN_PASS' \ +--data-dir '/var/lib/nextcloud/data'" +$STD su nextcloud -s /bin/sh -c 'php82 occ background:cron' +rm -rf /usr/share/webapps/nextcloud/apps/serverinfo +IP4=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) +sed -i "/0 => \'localhost\',/a \ \1 => '$IP4'," /usr/share/webapps/nextcloud/config/config.php +su nextcloud -s /bin/sh -c 'php82 -f /usr/share/webapps/nextcloud/cron.php' +msg_ok "Finished Nextcloud Setup-Wizard" + +motd_ssh +customize diff --git a/install/alpine-vaultwarden-install.sh b/install/alpine-vaultwarden-install.sh new file mode 100644 index 00000000..94956b70 --- /dev/null +++ b/install/alpine-vaultwarden-install.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" + +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apk add newt +$STD apk add curl +$STD apk add openssl +$STD apk add openssh +$STD apk add nano +$STD apk add mc +$STD apk add argon2 +msg_ok "Installed Dependencies" + +msg_info "Installing Alpine-Vaultwarden" +$STD apk add vaultwarden +sed -i -e 's/# export ADMIN_TOKEN=.*/export ADMIN_TOKEN='\'''\''/' -e '/^# export ROCKET_ADDRESS=0\.0\.0\.0/s/^# //' -e 's|export WEB_VAULT_ENABLED=.*|export WEB_VAULT_ENABLED=true|' /etc/conf.d/vaultwarden +msg_ok "Installed Alpine-Vaultwarden" + +msg_info "Installing Web-Vault" +$STD apk add vaultwarden-web-vault +msg_ok "Installed Web-Vault" + +msg_info "Starting Alpine-Vaultwarden" +$STD rc-service vaultwarden start +$STD rc-update add vaultwarden default +msg_ok "Started Alpine-Vaultwarden" + +motd_ssh +customize diff --git a/install/alpine-zigbee2mqtt-install.sh b/install/alpine-zigbee2mqtt-install.sh new file mode 100644 index 00000000..a98f1da5 --- /dev/null +++ b/install/alpine-zigbee2mqtt-install.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" + +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apk add newt +$STD apk add curl +$STD apk add openssh +$STD apk add nano +$STD apk add mc +msg_ok "Installed Dependencies" + +msg_info "Installing Alpine-Zigbee2MQTT" +$STD apk add zigbee2mqtt +mkdir -p /root/.z2m +ln -s /etc/zigbee2mqtt/ /root/.z2m +chown -R root:root /etc/zigbee2mqtt /root/.z2m +sed -i -e 's/#datadir="\/var\/lib\/zigbee2mqtt"/datadir="\/etc\/zigbee2mqtt"/' -e 's/#command_user="zigbee2mqtt"/command_user="root"/' /etc/conf.d/zigbee2mqtt +$STD rc-update add zigbee2mqtt +$STD rc-service zigbee2mqtt restart +msg_ok "Installed Alpine-Zigbee2MQTT" + +motd_ssh +customize diff --git a/install/apache-cassandra-install.sh b/install/apache-cassandra-install.sh new file mode 100644 index 00000000..35c49486 --- /dev/null +++ b/install/apache-cassandra-install.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y apt-transport-https +$STD apt-get install -y gpg +msg_ok "Installed Dependencies" + +msg_info "Installing Eclipse Temurin (Patience)" +wget -qO- https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor >/etc/apt/trusted.gpg.d/adoptium.gpg +echo 'deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/adoptium.gpg] https://packages.adoptium.net/artifactory/deb bookworm main' >/etc/apt/sources.list.d/adoptium.list +$STD apt-get update +$STD apt-get install -y temurin-11-jdk +msg_ok "Installed Eclipse Temurin" + +msg_info "Installing Apache Cassandra" +wget -qO- https://downloads.apache.org/cassandra/KEYS | gpg --dearmor >/etc/apt/trusted.gpg.d/cassandra.gpg +echo "deb https://debian.cassandra.apache.org 41x main" >/etc/apt/sources.list.d/cassandra.sources.list +$STD apt-get update +$STD apt-get install -y cassandra cassandra-tools +sed -i -e 's/^rpc_address: localhost/#rpc_address: localhost/g' -e 's/^# rpc_interface: eth1/rpc_interface: eth0/g' /etc/cassandra/cassandra.yaml +msg_ok "Installed Apache Cassandra" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/apache-couchdb-install.sh b/install/apache-couchdb-install.sh new file mode 100644 index 00000000..94902056 --- /dev/null +++ b/install/apache-couchdb-install.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y apt-transport-https +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Installing Apache CouchDB" +ERLANG_COOKIE=$(openssl rand -base64 32) +ADMIN_PASS="$(openssl rand -base64 18 | cut -c1-13)" +debconf-set-selections <<< "couchdb couchdb/cookie string $ERLANG_COOKIE" +debconf-set-selections <<< "couchdb couchdb/mode select standalone" +debconf-set-selections <<< "couchdb couchdb/bindaddress string 0.0.0.0" +debconf-set-selections <<< "couchdb couchdb/adminpass password $ADMIN_PASS" +debconf-set-selections <<< "couchdb couchdb/adminpass_again password $ADMIN_PASS" +curl -fsSL https://couchdb.apache.org/repo/keys.asc | gpg --dearmor -o /usr/share/keyrings/couchdb-archive-keyring.gpg +VERSION_CODENAME="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)" +echo "deb [signed-by=/usr/share/keyrings/couchdb-archive-keyring.gpg] https://apache.jfrog.io/artifactory/couchdb-deb/ ${VERSION_CODENAME} main" >/etc/apt/sources.list.d/couchdb.sources.list +$STD apt-get update +$STD apt-get install -y couchdb +echo -e "CouchDB Erlang Cookie: \e[32m$ERLANG_COOKIE\e[0m" >>~/CouchDB.creds +echo -e "CouchDB Admin Password: \e[32m$ADMIN_PASS\e[0m" >>~/CouchDB.creds +msg_ok "Installed Apache CouchDB." + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/apt-cacher-ng-install.sh b/install/apt-cacher-ng-install.sh new file mode 100644 index 00000000..b8e29316 --- /dev/null +++ b/install/apt-cacher-ng-install.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Apt-Cacher NG" +DEBIAN_FRONTEND=noninteractive $STD apt-get -o Dpkg::Options::="--force-confold" install -y apt-cacher-ng +sed -i 's/# PassThroughPattern: .* # this would allow CONNECT to everything/PassThroughPattern: .*/' /etc/apt-cacher-ng/acng.conf +systemctl enable -q --now apt-cacher-ng +msg_ok "Installed Apt-Cacher NG" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/aria2-install.sh b/install/aria2-install.sh new file mode 100644 index 00000000..f246bc9d --- /dev/null +++ b/install/aria2-install.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Aria2" +$STD apt-get install -y aria2 +msg_ok "Installed Aria2" + +read -r -p "Would you like to add AriaNG? " prompt +if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + msg_info "Installing AriaNG" + $STD apt-get install -y nginx + systemctl disable -q --now nginx + wget -q "$(curl -s https://api.github.com/repos/mayswind/ariang/releases/latest | grep download | grep AllInOne.zip | cut -d\" -f4)" + $STD unzip AriaNg-*-AllInOne.zip -d /var/www + rm /etc/nginx/sites-enabled/* + cat </etc/nginx/conf.d/ariang.conf +server { + listen 6880 default_server; + listen [::]:6880 default_server; + + server_name _; + + root /var/www; + index index.html; + + location / { + try_files \$uri \$uri/ =404; + } +} +EOF + cp /lib/systemd/system/nginx.service /lib/systemd/system/ariang.service + msg_ok "Installed AriaNG" +fi + +msg_info "Creating Service" +mkdir /root/downloads +rpc_secret=$(openssl rand -base64 8) +echo "rpc-secret: $rpc_secret" >>~/rpc.secret +cat </root/aria2.daemon +dir=/root/downloads +file-allocation=falloc +max-connection-per-server=4 +max-concurrent-downloads=2 +max-overall-download-limit=0 +min-split-size=25M +rpc-allow-origin-all=true +rpc-secret=${rpc_secret} +input-file=/var/tmp/aria2c.session +save-session=/var/tmp/aria2c.session +EOF + +cat </etc/systemd/system/aria2.service +[Unit] +Description=Aria2c download manager +After=network.target + +[Service] +Type=simple +User=root +Group=root +ExecStartPre=/usr/bin/env touch /var/tmp/aria2c.session +ExecStart=/usr/bin/aria2c --console-log-level=warn --enable-rpc --rpc-listen-all --conf-path=/root/aria2.daemon +TimeoutStopSec=20 +Restart=on-failure + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now aria2.service +systemctl enable -q --now ariang +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm AriaNg-*-AllInOne.zip +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" \ No newline at end of file diff --git a/install/audiobookshelf-install.sh b/install/audiobookshelf-install.sh new file mode 100644 index 00000000..cd9346e3 --- /dev/null +++ b/install/audiobookshelf-install.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y gnupg +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing audiobookshelf" +curl -fsSL https://advplyr.github.io/audiobookshelf-ppa/KEY.gpg >/etc/apt/trusted.gpg.d/audiobookshelf-ppa.asc +echo "deb [signed-by=/etc/apt/trusted.gpg.d/audiobookshelf-ppa.asc] https://advplyr.github.io/audiobookshelf-ppa ./" >/etc/apt/sources.list.d/audiobookshelf.list +$STD apt-get update +$STD apt install audiobookshelf +msg_ok "Installed audiobookshelf" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/autobrr-install.sh b/install/autobrr-install.sh new file mode 100644 index 00000000..510d1c0a --- /dev/null +++ b/install/autobrr-install.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Autobrr" +wget -q $(curl -s https://api.github.com/repos/autobrr/autobrr/releases/latest | grep download | grep linux_x86_64 | cut -d\" -f4) +tar -C /usr/local/bin -xzf autobrr*.tar.gz +rm -rf autobrr*.tar.gz +mkdir -p /root/.config/autobrr +cat <>/root/.config/autobrr/config.toml +# https://autobrr.com/configuration/autobrr +host = "0.0.0.0" +port = 7474 +logLevel = "DEBUG" +sessionSecret = "$(openssl rand -base64 24)" +EOF +msg_ok "Installed Autobrr" + +msg_info "Creating Service" +service_path="/etc/systemd/system/autobrr.service" +echo "[Unit] +Description=autobrr service +After=syslog.target network-online.target +[Service] +Type=simple +User=root +Group=root +ExecStart=/usr/local/bin/autobrr --config=/root/.config/autobrr/ +[Install] +WantedBy=multi-user.target" >$service_path +systemctl enable --now -q autobrr.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/bazarr-install.sh b/install/bazarr-install.sh new file mode 100755 index 00000000..a4ee4cbb --- /dev/null +++ b/install/bazarr-install.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Updating Python3" +$STD apt-get install -y \ + python3 \ + python3-dev \ + python3-pip +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Updated Python3" + +msg_info "Installing Bazarr" +mkdir -p /var/lib/bazarr/ +wget -q https://github.com/morpheus65535/bazarr/releases/latest/download/bazarr.zip +unzip -qq bazarr -d /opt/bazarr +chmod 775 /opt/bazarr /var/lib/bazarr/ +python3 -m pip install -q -r /opt/bazarr/requirements.txt +msg_ok "Installed Bazarr" + +msg_info "Creating Service" +cat </etc/systemd/system/bazarr.service +[Unit] +Description=Bazarr Daemon +After=syslog.target network.target + +[Service] +WorkingDirectory=/opt/bazarr/ +UMask=0002 +Restart=on-failure +RestartSec=5 +Type=simple +ExecStart=/usr/bin/python3 /opt/bazarr/bazarr.py +KillSignal=SIGINT +TimeoutStopSec=20 +SyslogIdentifier=bazarr + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now bazarr +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf bazarr.zip +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" \ No newline at end of file diff --git a/install/blocky-install.sh b/install/blocky-install.sh new file mode 100644 index 00000000..d3ba2b50 --- /dev/null +++ b/install/blocky-install.sh @@ -0,0 +1,290 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Blocky" +if systemctl is-active systemd-resolved > /dev/null 2>&1; then + systemctl disable -q --now systemd-resolved +fi +mkdir /opt/blocky +RELEASE=$(curl -s https://api.github.com/repos/0xERR0R/blocky/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +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 + +# optional: timeout to query the upstream resolver. Default: 2s +#upstreamTimeout: 2s + +# 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.) +blocking: + # definition of blacklist groups. Can be external link (http/https) or local file + blackLists: + 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 + +# 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: 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 +EOF +msg_ok "Installed Blocky" + +msg_info "Creating Service" +cat </etc/systemd/system/blocky.service +[Unit] +Description=Blocky +After=network.target +[Service] +User=root +WorkingDirectory=/opt/blocky +ExecStart=/opt/blocky/./blocky --config config.yml +[Install] +WantedBy=multi-user.target +EOF +$STD systemctl enable --now blocky +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/bunkerweb-install.sh b/install/bunkerweb-install.sh new file mode 100644 index 00000000..4f15709c --- /dev/null +++ b/install/bunkerweb-install.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +$STD apt-get install -y apt-transport-https +$STD apt-get install -y lsb-release +msg_ok "Installed Dependencies" + +msg_info "Installing Nginx" +wget -qO- https://nginx.org/keys/nginx_signing.key | gpg --dearmor >/usr/share/keyrings/nginx-archive-keyring.gpg +echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/debian $(lsb_release -cs) nginx" >/etc/apt/sources.list.d/nginx.list +$STD apt-get update +$STD apt-get install -y nginx +msg_ok "Installed Nginx" + +RELEASE=$(curl -s https://api.github.com/repos/bunkerity/bunkerweb/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +msg_info "Installing BunkerWeb v${RELEASE} (Patience)" +curl -fsSL "https://repo.bunkerweb.io/bunkerity/bunkerweb/gpgkey" | gpg --dearmor >/etc/apt/keyrings/bunkerity_bunkerweb-archive-keyring.gpg +echo "deb [signed-by=/etc/apt/keyrings/bunkerity_bunkerweb-archive-keyring.gpg] https://repo.bunkerweb.io/bunkerity/bunkerweb/debian/ bookworm main" >/etc/apt/sources.list.d/bunkerity_bunkerweb.list +$STD apt-get update +export UI_WIZARD=1 +$STD apt-get install -y bunkerweb=${RELEASE} +cat </etc/apt/preferences.d/bunkerweb +Package: bunkerweb +Pin: version ${RELEASE} +Pin-Priority: 1001 +EOF +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed BunkerWeb v${RELEASE}" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/caddy-install.sh b/install/caddy-install.sh new file mode 100644 index 00000000..88fb8b1a --- /dev/null +++ b/install/caddy-install.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 {debian-keyring,debian-archive-keyring,apt-transport-https,gpg,curl,sudo,mc} +msg_ok "Installed Dependencies" + +msg_info "Installing Caddy" +curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg +curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' >/etc/apt/sources.list.d/caddy-stable.list +$STD apt-get update +$STD apt-get install -y caddy +msg_ok "Installed Caddy" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/calibre-web-install.sh b/install/calibre-web-install.sh new file mode 100644 index 00000000..1f42bbaf --- /dev/null +++ b/install/calibre-web-install.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: remz1337 +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y imagemagick +msg_ok "Installed Dependencies" + +msg_info "Installing Python Dependencies" +$STD apt-get -y install python3-pip +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Installed Python Dependencies" + +msg_info "Installing Kepubify" +mkdir -p /opt/kepubify +cd /opt/kepubify +curl -fsSLO https://github.com/pgaskin/kepubify/releases/latest/download/kepubify-linux-64bit &>/dev/null +chmod +x kepubify-linux-64bit +msg_ok "Installed Kepubify" + +msg_info "Installing Calibre-Web" +mkdir -p /opt/calibre-web +$STD wget https://github.com/janeczku/calibre-web/raw/master/library/metadata.db -P /opt/calibre-web +$STD pip install calibreweb +$STD pip install jsonschema +msg_ok "Installed Calibre-Web" + +msg_info "Creating Service" +cat </etc/systemd/system/cps.service +[Unit] +Description=Calibre-Web Server +After=network.target + +[Service] +Type=simple +WorkingDirectory=/opt/calibre-web +ExecStart=/usr/local/bin/cps +TimeoutStopSec=20 +KillMode=process +Restart=on-failure + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now cps.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/casaos-install.sh b/install/casaos-install.sh new file mode 100644 index 00000000..e7e07a61 --- /dev/null +++ b/install/casaos-install.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing CasaOS (Patience)" +DOCKER_CONFIG_PATH='/etc/docker/daemon.json' +mkdir -p $(dirname $DOCKER_CONFIG_PATH) +echo -e '{\n "log-driver": "journald"\n}' > /etc/docker/daemon.json +$STD bash <(curl -fsSL https://get.casaos.io/v0.4.1) +msg_ok "Installed CasaOS" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/changedetection-install.sh b/install/changedetection-install.sh new file mode 100644 index 00000000..5a10f779 --- /dev/null +++ b/install/changedetection-install.sh @@ -0,0 +1,163 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get install -y \ + curl \ + sudo \ + mc \ + git \ + build-essential \ + dumb-init \ + gconf-service \ + libjpeg-dev \ + libatk-bridge2.0-0 \ + libasound2 \ + libatk1.0-0 \ + libcairo2 \ + libcups2 \ + libdbus-1-3 \ + libexpat1 \ + libgbm-dev \ + libgbm1 \ + libgconf-2-4 \ + libgdk-pixbuf2.0-0 \ + libglib2.0-0 \ + libgtk-3-0 \ + libnspr4 \ + libnss3 \ + libpango-1.0-0 \ + libpangocairo-1.0-0 \ + qpdf \ + xdg-utils \ + xvfb \ + ca-certificates \ + gnupg +msg_ok "Installed Dependencies" + +msg_info "Updating Python3" +$STD apt-get install -y \ + python3 \ + python3-dev \ + python3-pip +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Updated Python3" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing Change Detection" +mkdir /opt/changedetection +$STD pip3 install changedetection.io +msg_ok "Installed Change Detection" + +msg_info "Installing Browserless & Playwright" +mkdir /opt/browserless +$STD python3 -m pip install playwright +$STD git clone -b v1 https://github.com/browserless/chrome /opt/browserless +$STD npm install --prefix /opt/browserless +$STD npm run build --prefix /opt/browserless +$STD npm prune production --prefix /opt/browserless +msg_ok "Installed Browserless & Playwright" + +msg_info "Installing Font Packages" +$STD apt-get install -y \ + fontconfig \ + libfontconfig1 \ + fonts-freefont-ttf \ + fonts-gfs-neohellenic \ + fonts-indic fonts-ipafont-gothic \ + fonts-kacst fonts-liberation \ + fonts-noto-cjk \ + fonts-noto-color-emoji \ + msttcorefonts \ + fonts-roboto \ + fonts-thai-tlwg \ + fonts-wqy-zenhei +msg_ok "Installed Font Packages" + +msg_info "Installing X11 Packages" +$STD apt-get install -y \ + libx11-6 \ + libx11-xcb1 \ + libxcb1 \ + libxcomposite1 \ + libxcursor1 \ + libxdamage1 \ + libxext6 \ + libxfixes3 \ + libxi6 \ + libxrandr2 \ + libxrender1 \ + libxss1 \ + libxtst6 +msg_ok "Installed X11 Packages" + +msg_info "Creating Services" +cat </etc/systemd/system/changedetection.service +[Unit] +Description=Change Detection +After=network-online.target +After=network.target browserless.service +Wants=browserless.service +[Service] +Type=simple +WorkingDirectory=/opt/changedetection +Environment="WEBDRIVER_URL=http://127.0.0.1:4444/wd/hub" +Environment="PLAYWRIGHT_DRIVER_URL=ws://127.0.0.1:3000/?stealth=1&--disable-web-security=true" +ExecStart=changedetection.io -d /opt/changedetection -p 5000 +[Install] +WantedBy=multi-user.target +EOF + +cat </etc/systemd/system/browserless.service +[Unit] +Description=browserless service +After=network.target +[Service] +Environment=APP_DIR=/opt/browserless +Environment=PLAYWRIGHT_BROWSERS_PATH=/opt/browserless +Environment=CONNECTION_TIMEOUT=60000 +Environment=HOST=127.0.0.1 +Environment=LANG="C.UTF-8" +Environment=NODE_ENV=production +Environment=PORT=3000 +Environment=WORKSPACE_DIR=/opt/browserless/workspace +WorkingDirectory=/opt/browserless +ExecStart=/opt/browserless/start.sh +SyslogIdentifier=browserless +[Install] +WantedBy=default.target +EOF + +systemctl enable -q --now browserless +systemctl enable -q --now changedetection +msg_ok "Created Services" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/channels-install.sh b/install/channels-install.sh new file mode 100644 index 00000000..3c5e2d9d --- /dev/null +++ b/install/channels-install.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y chromium +$STD apt-get install -y xvfb +msg_ok "Installed Dependencies" + +if [[ "$CTTYPE" == "0" ]]; then + msg_info "Setting Up Hardware Acceleration" + $STD apt-get -y install \ + va-driver-all \ + ocl-icd-libopencl1 \ + intel-opencl-icd + chgrp video /dev/dri + chmod 755 /dev/dri + chmod 660 /dev/dri/* + $STD adduser $(id -u -n) video + $STD adduser $(id -u -n) render + msg_ok "Set Up Hardware Acceleration" +fi + +msg_info "Installing Channels DVR Server (Patience)" +cd /opt +$STD bash <(curl -fsSL https://getchannels.com/dvr/setup.sh) +sed -i -e 's/^sgx:x:104:$/render:x:104:root/' -e 's/^render:x:106:root$/sgx:x:106:/' /etc/group +msg_ok "Installed Channels DVR Server" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/cloudflared-install.sh b/install/cloudflared-install.sh new file mode 100644 index 00000000..abd45e47 --- /dev/null +++ b/install/cloudflared-install.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Cloudflared" +mkdir -p --mode=0755 /usr/share/keyrings +VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)" +curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg >/usr/share/keyrings/cloudflare-main.gpg +echo "deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared $VERSION main" >/etc/apt/sources.list.d/cloudflared.list +$STD apt-get update +$STD apt-get install -y cloudflared +msg_ok "Installed Cloudflared" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/commafeed-install.sh b/install/commafeed-install.sh new file mode 100644 index 00000000..8db106e7 --- /dev/null +++ b/install/commafeed-install.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Azul Zulu" +wget -qO /etc/apt/trusted.gpg.d/zulu-repo.asc "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xB1998361219BD9C9" +wget -q https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-3_all.deb +$STD dpkg -i zulu-repo_1.0.0-3_all.deb +$STD apt-get update +$STD apt-get -y install zulu17-jdk +msg_ok "Installed Azul Zulu" + +msg_info "Installing CommaFeed" +mkdir /opt/commafeed && cd /opt/commafeed +wget -q https://github.com/Athou/commafeed/releases/latest/download/commafeed.jar +wget -q https://github.com/Athou/commafeed/releases/latest/download/config.yml.example -O config.yml +msg_ok "Installed CommaFeed" + +msg_info "Creating Service" +cat </etc/systemd/system/commafeed.service +[Unit] +Description=CommaFeed Service +After=network.target + +[Service] +ExecStart=/usr/bin/java -Djava.net.preferIPv4Stack=true -jar /opt/commafeed/commafeed.jar server /opt/commafeed/config.yml +WorkingDirectory=/opt/commafeed/ +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now commafeed.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf zulu-repo_1.0.0-3_all.deb +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/cronicle-install.sh b/install/cronicle-install.sh new file mode 100644 index 00000000..c3ea5a8a --- /dev/null +++ b/install/cronicle-install.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y make +$STD apt-get install -y g++ +$STD apt-get install -y gcc +msg_ok "Installed Dependencies" + +msg_info "Installing Node.js" +$STD bash <(curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh) +. ~/.bashrc +$STD nvm install 16.20.1 +ln -sf /root/.nvm/versions/node/v16.20.1/bin/node /usr/bin/node +msg_ok "Installed Node.js" + +msg_info "Installing Cronicle Primary Server" +LATEST=$(curl -sL https://api.github.com/repos/jhuckaby/Cronicle/releases/latest | grep '"tag_name":' | cut -d'"' -f4) +IP=$(hostname -I | awk '{print $1}') +mkdir -p /opt/cronicle +cd /opt/cronicle +$STD tar zxvf <(curl -fsSL https://github.com/jhuckaby/Cronicle/archive/${LATEST}.tar.gz) --strip-components 1 +$STD npm install +$STD node bin/build.js dist +sed -i "s/localhost:3012/${IP}:3012/g" /opt/cronicle/conf/config.json +$STD /opt/cronicle/bin/control.sh setup +$STD /opt/cronicle/bin/control.sh start +$STD cp /opt/cronicle/bin/cronicled.init /etc/init.d/cronicled +chmod 775 /etc/init.d/cronicled +$STD update-rc.d cronicled defaults +msg_ok "Installed Cronicle Primary Server" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/daemonsync-install.sh b/install/daemonsync-install.sh new file mode 100644 index 00000000..483e27aa --- /dev/null +++ b/install/daemonsync-install.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y g++-multilib +msg_ok "Installed Dependencies" + +msg_info "Installing Daemon Sync Server" +wget -qL https://github.com/tteck/Proxmox/raw/main/misc/daemonsync_2.2.0.0059_amd64.deb +$STD dpkg -i daemonsync_2.2.0.0059_amd64.deb +msg_ok "Installed Daemon Sync Server" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf daemonsync_2.2.0.0059_amd64.deb +$STD apt-get autoremove >/dev/null +$STD apt-get autoclean >/dev/null +msg_ok "Cleaned" diff --git a/install/dashy-install.sh b/install/dashy-install.sh new file mode 100644 index 00000000..a81749ae --- /dev/null +++ b/install/dashy-install.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +RELEASE=$(curl -s https://api.github.com/repos/Lissy93/dashy/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +msg_info "Installing Dashy ${RELEASE} (Patience)" +mkdir -p /opt/dashy +wget -qO- https://github.com/Lissy93/dashy/archive/refs/tags/${RELEASE}.tar.gz | tar -xz -C /opt/dashy --strip-components=1 +cd /opt/dashy +$STD npm install +$STD npm run build +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed Dashy ${RELEASE}" + +msg_info "Creating Service" +cat </etc/systemd/system/dashy.service +[Unit] +Description=dashy + +[Service] +Type=simple +WorkingDirectory=/opt/dashy +ExecStart=/usr/bin/npm start +[Install] +WantedBy=multi-user.target +EOF +systemctl -q --now enable dashy +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/debian-install.sh b/install/debian-install.sh new file mode 100644 index 00000000..bb89300e --- /dev/null +++ b/install/debian-install.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" \ No newline at end of file diff --git a/install/deconz-install.sh b/install/deconz-install.sh new file mode 100644 index 00000000..203f5191 --- /dev/null +++ b/install/deconz-install.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Setting Phoscon Repository" +VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)" +curl -fsSL http://phoscon.de/apt/deconz.pub.key >/etc/apt/trusted.gpg.d/deconz.pub.asc +echo "deb [arch=amd64] http://phoscon.de/apt/deconz $VERSION main" >/etc/apt/sources.list.d/deconz.list +msg_ok "Setup Phoscon Repository" + +msg_info "Installing deConz" +libssl=$(curl -fsSL "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/" | grep -o 'libssl1\.1_1\.1\.1f-1ubuntu2\.2[^"]*amd64\.deb' | head -n1) +wget -qL http://security.ubuntu.com/ubuntu/pool/main/o/openssl/$libssl +$STD dpkg -i $libssl +$STD apt-get update +$STD apt-get install -y deconz +msg_ok "Installed deConz" + +msg_info "Creating Service" +cat </lib/systemd/system/deconz.service +[Unit] +Description=deCONZ: ZigBee gateway -- REST API +Wants=deconz-init.service deconz-update.service +StartLimitIntervalSec=0 + +[Service] +User=root +ExecStart=/usr/bin/deCONZ -platform minimal --http-port=80 +Restart=on-failure +RestartSec=30 +AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_KILL CAP_SYS_BOOT CAP_SYS_TIME + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now deconz +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf $libssl +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/deluge-install.sh b/install/deluge-install.sh new file mode 100644 index 00000000..979b22b6 --- /dev/null +++ b/install/deluge-install.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y python3-libtorrent +msg_ok "Installed Dependencies" + +msg_info "Updating Python3" +$STD apt-get install -y \ + python3 \ + python3-dev \ + python3-pip +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Updated Python3" + +msg_info "Installing Deluge" +$STD pip install deluge[all] +msg_ok "Installed Deluge" + +msg_info "Creating Service" +service_path="/etc/systemd/system/deluged.service" +echo "[Unit] +Description=Deluge Bittorrent Client Daemon +Documentation=man:deluged +After=network-online.target + +[Service] +Type=simple +UMask=007 +ExecStart=/usr/local/bin/deluged -d +Restart=on-failure +TimeoutStopSec=300 + +[Install] +WantedBy=multi-user.target" >$service_path + +service_path="/etc/systemd/system/deluge-web.service" +echo "[Unit] +Description=Deluge Bittorrent Client Web Interface +Documentation=man:deluge-web +After=deluged.service +Wants=deluged.service + +[Service] +Type=simple +UMask=027 +ExecStart=/usr/local/bin/deluge-web -d +Restart=on-failure + +[Install] +WantedBy=multi-user.target" >$service_path +systemctl enable --now -q deluged.service +systemctl enable --now -q deluge-web.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/docker-install.sh b/install/docker-install.sh new file mode 100644 index 00000000..b6b110ae --- /dev/null +++ b/install/docker-install.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +get_latest_release() { + curl -sL https://api.github.com/repos/$1/releases/latest | grep '"tag_name":' | cut -d'"' -f4 +} + +DOCKER_LATEST_VERSION=$(get_latest_release "moby/moby") +PORTAINER_LATEST_VERSION=$(get_latest_release "portainer/portainer") +PORTAINER_AGENT_LATEST_VERSION=$(get_latest_release "portainer/agent") +DOCKER_COMPOSE_LATEST_VERSION=$(get_latest_release "docker/compose") + +msg_info "Installing Docker $DOCKER_LATEST_VERSION" +DOCKER_CONFIG_PATH='/etc/docker/daemon.json' +mkdir -p $(dirname $DOCKER_CONFIG_PATH) +echo -e '{\n "log-driver": "journald"\n}' >/etc/docker/daemon.json +$STD sh <(curl -sSL https://get.docker.com) +msg_ok "Installed Docker $DOCKER_LATEST_VERSION" + +read -r -p "Would you like to add Portainer? " prompt +if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + msg_info "Installing Portainer $PORTAINER_LATEST_VERSION" + docker volume create portainer_data >/dev/null + $STD docker run -d \ + -p 8000:8000 \ + -p 9443:9443 \ + --name=portainer \ + --restart=always \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v portainer_data:/data \ + portainer/portainer-ce:latest + msg_ok "Installed Portainer $PORTAINER_LATEST_VERSION" +else + read -r -p "Would you like to add the Portainer Agent? " prompt + if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + msg_info "Installing Portainer agent $PORTAINER_AGENT_LATEST_VERSION" + $STD docker run -d \ + -p 9001:9001 \ + --name portainer_agent \ + --restart=always \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v /var/lib/docker/volumes:/var/lib/docker/volumes \ + portainer/agent + msg_ok "Installed Portainer Agent $PORTAINER_AGENT_LATEST_VERSION" + fi +fi +read -r -p "Would you like to add Docker Compose? " prompt +if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + msg_info "Installing Docker Compose $DOCKER_COMPOSE_LATEST_VERSION" + DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} + mkdir -p $DOCKER_CONFIG/cli-plugins + curl -sSL https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_LATEST_VERSION/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose + chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose + msg_ok "Installed Docker Compose $DOCKER_COMPOSE_LATEST_VERSION" +fi + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/dockge-install.sh b/install/dockge-install.sh new file mode 100644 index 00000000..3cb46245 --- /dev/null +++ b/install/dockge-install.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +get_latest_release() { + curl -sL https://api.github.com/repos/$1/releases/latest | grep '"tag_name":' | cut -d'"' -f4 +} + +DOCKER_LATEST_VERSION=$(get_latest_release "moby/moby") +DOCKER_COMPOSE_LATEST_VERSION=$(get_latest_release "docker/compose") + +msg_info "Installing Docker $DOCKER_LATEST_VERSION" +DOCKER_CONFIG_PATH='/etc/docker/daemon.json' +mkdir -p $(dirname $DOCKER_CONFIG_PATH) +echo -e '{\n "log-driver": "journald"\n}' >/etc/docker/daemon.json +$STD sh <(curl -sSL https://get.docker.com) +msg_ok "Installed Docker $DOCKER_LATEST_VERSION" + +msg_info "Installing Docker Compose $DOCKER_COMPOSE_LATEST_VERSION" +DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} +mkdir -p $DOCKER_CONFIG/cli-plugins +curl -sSL https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_LATEST_VERSION/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose +chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose +msg_ok "Installed Docker Compose $DOCKER_COMPOSE_LATEST_VERSION" + +msg_info "Installing Dockge" +mkdir -p /opt/{dockge,stacks} +wget -q -O /opt/dockge/compose.yaml https://raw.githubusercontent.com/louislam/dockge/master/compose.yaml +cd /opt/dockge +$STD docker compose up -d +msg_ok "Installed Dockge" + +read -r -p "Would you like to add Immich? " prompt +if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + msg_info "Adding Immich compose.yaml" + mkdir -p /opt/stacks/immich + wget -q -O /opt/stacks/immich/compose.yaml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml + wget -q -O /opt/stacks/immich/.env https://github.com/immich-app/immich/releases/latest/download/example.env + #wget -q -O /opt/stacks/immich/hwaccel.ml.yml https://github.com/immich-app/immich/releases/latest/download/hwaccel.ml.yml + msg_ok "Added Immich compose.yaml" +fi + +read -r -p "Would you like to add Home Assistant? " prompt +if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + msg_info "Adding Home Assistant compose.yaml" + mkdir -p /opt/stacks/homeassistant + cat </opt/stacks/homeassistant/compose.yaml +version: "3" +services: + homeassistant: + container_name: homeassistant + image: ghcr.io/home-assistant/home-assistant:stable + volumes: + - ./config:/config + - /etc/localtime:/etc/localtime:ro + - /run/dbus:/run/dbus:ro + restart: unless-stopped + privileged: true + network_mode: host +EOF +msg_ok "Added Home Assistant compose.yaml" +fi + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/emby-install.sh b/install/emby-install.sh new file mode 100644 index 00000000..bc6ba9be --- /dev/null +++ b/install/emby-install.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Setting Up Hardware Acceleration" +$STD apt-get -y install {va-driver-all,ocl-icd-libopencl1,intel-opencl-icd,vainfo,intel-gpu-tools} +if [[ "$CTTYPE" == "0" ]]; then + chgrp video /dev/dri + chmod 755 /dev/dri + chmod 660 /dev/dri/* + $STD adduser $(id -u -n) video + $STD adduser $(id -u -n) render +fi +msg_ok "Set Up Hardware Acceleration" + +LATEST=$(curl -sL https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | grep '"tag_name":' | cut -d'"' -f4) + +msg_info "Installing Emby" +wget -q https://github.com/MediaBrowser/Emby.Releases/releases/download/${LATEST}/emby-server-deb_${LATEST}_amd64.deb +$STD dpkg -i emby-server-deb_${LATEST}_amd64.deb +if [[ "$CTTYPE" == "0" ]]; then + sed -i -e 's/^ssl-cert:x:104:$/render:x:104:root,emby/' -e 's/^render:x:108:root,emby$/ssl-cert:x:108:/' /etc/group +else + sed -i -e 's/^ssl-cert:x:104:$/render:x:104:emby/' -e 's/^render:x:108:emby$/ssl-cert:x:108:/' /etc/group +fi +msg_ok "Installed Emby" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +rm emby-server-deb_${LATEST}_amd64.deb +msg_ok "Cleaned" diff --git a/install/emqx-install.sh b/install/emqx-install.sh new file mode 100644 index 00000000..16475d53 --- /dev/null +++ b/install/emqx-install.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing EMQX" +$STD bash <(curl -fsSL https://packagecloud.io/install/repositories/emqx/emqx/script.deb.sh) +$STD apt-get install -y emqx +$STD systemctl enable --now emqx +msg_ok "Installed EMQX" + +motd_ssh +customize + +msg_info "Cleaning up" +apt-get autoremove >/dev/null +apt-get autoclean >/dev/null +msg_ok "Cleaned" diff --git a/install/ersatztv-install.sh b/install/ersatztv-install.sh new file mode 100644 index 00000000..e4068612 --- /dev/null +++ b/install/ersatztv-install.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +# Source: https://github.com/ErsatzTV/ErsatzTV + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get install -y --no-install-recommends \ + ffmpeg \ + build-essential \ + unzip \ + pkg-config \ + curl \ + sudo \ + git \ + make \ + mc +msg_ok "Installed Dependencies" + + +msg_info "Installing ErsatzTV " +RELEASE=$(curl -s https://api.github.com/repos/ErsatzTV/ErsatzTV/releases | grep -oP '"tag_name": "\K[^"]+' | head -n 1) +wget -qO- "https://github.com/ErsatzTV/ErsatzTV/releases/download/${RELEASE}/ErsatzTV-${RELEASE}-linux-x64.tar.gz" | tar -xz -C /opt +mv "/opt/ErsatzTV-${RELEASE}-linux-x64" /opt/ErsatzTV +msg_ok "Installed ErsatzTV" + +msg_info "Creating Service" +cat </etc/systemd/system/ersatzTV.service +[Unit] +Description=ErsatzTV Service +After=multi-user.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/ErsatzTV +ExecStart=/opt/ErsatzTV/ErsatzTV +Restart=always +RestartSec=30 + +[Install] +WantedBy=multi-user.target +EOF +systemctl -q --now enable ersatzTV.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/esphome-install.sh b/install/esphome-install.sh new file mode 100644 index 00000000..301d9bbb --- /dev/null +++ b/install/esphome-install.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +msg_ok "Installed Dependencies" + +msg_info "Updating Python3" +$STD apt-get install -y \ + python3 \ + python3-dev \ + python3-pip \ + python3-venv +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Updated Python3" + +msg_info "Installing ESPHome" +mkdir /root/config +$STD pip install esphome tornado esptool +msg_ok "Installed ESPHome" + +msg_info "Creating Service" +cat </etc/systemd/system/esphomeDashboard.service +[Unit] +Description=ESPHome Dashboard +After=network.target + +[Service] +ExecStart=/usr/local/bin/esphome dashboard /root/config/ +Restart=always +User=root + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now esphomeDashboard.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/fenrus-install.sh b/install/fenrus-install.sh new file mode 100644 index 00000000..fa0f9500 --- /dev/null +++ b/install/fenrus-install.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: Scorpoon +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +# Source: https://github.com/revenz/Fenrus + + + +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 sudo +$STD apt-get install -y mc +$STD apt-get install -y curl +$STD apt-get install -y git +msg_ok "Installed Dependencies" + +msg_info "Installing ASP.NET Core 7 SDK" +var_os=$(grep "^ID=" /etc/os-release | cut -d'=' -f2 | tr -d '"') +var_version=$(grep "^VERSION_ID=" /etc/os-release | cut -d'=' -f2 | tr -d '"') +if [ "${var_os}" = "debian" ]; then + wget -q "https://packages.microsoft.com/config/debian/$var_version/packages-microsoft-prod.deb" + $STD dpkg -i packages-microsoft-prod.deb + rm packages-microsoft-prod.deb +fi +$STD apt-get update +$STD apt-get install -y dotnet-sdk-7.0 +msg_ok "Installed ASP.NET Core 7 SDK" + +msg_info "Installing ${APPLICATION}" +git clone -q https://github.com/revenz/Fenrus.git /opt/${APPLICATION} +cd /opt/${APPLICATION} +$STD dotnet publish -c Release -o "/opt/${APPLICATION}/" Fenrus.csproj +msg_ok "Installed ${APPLICATION}" + +msg_info "Creating Service" +cat </etc/systemd/system/"${APPLICATION}".service +[Unit] +Description=${APPLICATION} + +[Service] +WorkingDirectory=/opt/${APPLICATION} +ExecStart=/usr/bin/dotnet Fenrus.dll --urls=http://*:5000 +SyslogIdentifier=${APPLICATION} +User=root + +[Install] +WantedBy=multi-user.target +EOF +$STD systemctl enable -q --now ${APPLICATION} +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/fhem-install.sh b/install/fhem-install.sh new file mode 100644 index 00000000..ccc078fe --- /dev/null +++ b/install/fhem-install.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y avahi-daemon +$STD apt-get install -y gnupg2 +msg_ok "Installed Dependencies" + +msg_info "Setting up Fhem Repository" +curl -sSf https://debian.fhem.de/archive.key | gpg --dearmor >/etc/apt/trusted.gpg.d/debianfhemde-archive-keyring.gpg +echo 'deb [signed-by=/etc/apt/trusted.gpg.d/debianfhemde-archive-keyring.gpg] https://debian.fhem.de/nightly/ /' >/etc/apt/sources.list.d/fhem.list +msg_ok "Set up Fhem Repository" + +msg_info "Installing Fhem" +$STD apt-get update +$STD apt-get install -y fhem +msg_info "Installed Fhem" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/flaresolverr-install.sh b/install/flaresolverr-install.sh new file mode 100644 index 00000000..93c7fdd4 --- /dev/null +++ b/install/flaresolverr-install.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: remz1337 +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y apt-transport-https +$STD apt-get install -y gpg +$STD apt-get install -y xvfb +msg_ok "Installed Dependencies" + +msg_info "Installing Chrome" +wget -qO- https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg +echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list +$STD apt update +$STD apt install -y google-chrome-stable +msg_ok "Installed Chrome" + +msg_info "Installing FlareSolverr" +RELEASE=$(wget -q https://github.com/FlareSolverr/FlareSolverr/releases/latest -O - | grep "title>Release" | cut -d " " -f 4) +$STD wget -q https://github.com/FlareSolverr/FlareSolverr/releases/download/$RELEASE/flaresolverr_linux_x64.tar.gz +$STD tar -xzf flaresolverr_linux_x64.tar.gz -C /opt +$STD rm flaresolverr_linux_x64.tar.gz +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed FlareSolverr" + +msg_info "Creating Service" +cat </etc/systemd/system/flaresolverr.service +[Unit] +Description=FlareSolverr +After=network.target +[Service] +SyslogIdentifier=flaresolverr +Restart=always +RestartSec=5 +Type=simple +Environment="LOG_LEVEL=info" +Environment="CAPTCHA_SOLVER=none" +WorkingDirectory=/opt/flaresolverr +ExecStart=/opt/flaresolverr/flaresolverr +TimeoutStopSec=30 +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now flaresolverr.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/flowiseai-install.sh b/install/flowiseai-install.sh new file mode 100644 index 00000000..31807365 --- /dev/null +++ b/install/flowiseai-install.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +msg_ok "Installed Dependencies" + +msg_info "Installing Node.js" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing FlowiseAI (Patience)" +$STD npm install -g flowise +mkdir -p /opt/flowiseai +wget -q https://raw.githubusercontent.com/FlowiseAI/Flowise/main/packages/server/.env.example -O /opt/flowiseai/.env +msg_ok "Installed FlowiseAI" + +msg_info "Creating Service" +cat </etc/systemd/system/flowise.service +[Unit] +Description=FlowiseAI +After=network.target + +[Service] +EnvironmentFile=/opt/flowiseai/.env +ExecStart=npx flowise start +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now flowise.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/forgejo-install.sh b/install/forgejo-install.sh new file mode 100644 index 00000000..a2e28169 --- /dev/null +++ b/install/forgejo-install.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y git-lfs +msg_ok "Installed Dependencies" + +msg_info "Installing Forgejo" +mkdir -p /opt/forgejo +RELEASE=$(curl -s https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/latest | grep -oP '"tag_name":\s*"\K[^"]+' | sed 's/^v//') +wget -qO /opt/forgejo/forgejo-$RELEASE-linux-amd64 "https://codeberg.org/forgejo/forgejo/releases/download/v${RELEASE}/forgejo-${RELEASE}-linux-amd64" +chmod +x /opt/forgejo/forgejo-$RELEASE-linux-amd64 +ln -sf /opt/forgejo/forgejo-$RELEASE-linux-amd64 /usr/local/bin/forgejo +msg_ok "Installed Forgejo" + +msg_info "Setting up Forgejo" +$STD adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git +mkdir /var/lib/forgejo +chown git:git /var/lib/forgejo +chmod 750 /var/lib/forgejo +mkdir /etc/forgejo +chown root:git /etc/forgejo +chmod 770 /etc/forgejo +msg_ok "Setup Forgejo" + +msg_info "Creating Service" +cat </etc/systemd/system/forgejo.service +[Unit] +Description=Forgejo +After=syslog.target +After=network.target +[Service] +RestartSec=2s +Type=simple +User=git +Group=git +WorkingDirectory=/var/lib/forgejo/ +ExecStart=/usr/local/bin/forgejo web --config /etc/forgejo/app.ini +Restart=always +Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/forgejo +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now forgejo +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/frigate-install.sh b/install/frigate-install.sh new file mode 100644 index 00000000..f9765286 --- /dev/null +++ b/install/frigate-install.sh @@ -0,0 +1,263 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Authors: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get install -y {curl,sudo,mc,git,gpg,automake,build-essential,xz-utils,libtool,ccache,pkg-config,libgtk-3-dev,libavcodec-dev,libavformat-dev,libswscale-dev,libv4l-dev,libxvidcore-dev,libx264-dev,libjpeg-dev,libpng-dev,libtiff-dev,gfortran,openexr,libatlas-base-dev,libssl-dev,libtbb2,libtbb-dev,libdc1394-22-dev,libopenexr-dev,libgstreamer-plugins-base1.0-dev,libgstreamer1.0-dev,gcc,gfortran,libopenblas-dev,liblapack-dev,libusb-1.0-0-dev,jq} +msg_ok "Installed Dependencies" + +msg_info "Installing Python3 Dependencies" +$STD apt-get install -y {python3,python3-dev,python3-setuptools,python3-distutils,python3-pip} +msg_ok "Installed Python3 Dependencies" + +msg_info "Installing Node.js" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing go2rtc" +mkdir -p /usr/local/go2rtc/bin +cd /usr/local/go2rtc/bin +wget -qO go2rtc "https://github.com/AlexxIT/go2rtc/releases/latest/download/go2rtc_linux_amd64" +chmod +x go2rtc +$STD ln -svf /usr/local/go2rtc/bin/go2rtc /usr/local/bin/go2rtc +msg_ok "Installed go2rtc" + +msg_info "Setting Up Hardware Acceleration" +$STD apt-get -y install {va-driver-all,ocl-icd-libopencl1,intel-opencl-icd,vainfo,intel-gpu-tools} +if [[ "$CTTYPE" == "0" ]]; then + chgrp video /dev/dri + chmod 755 /dev/dri + chmod 660 /dev/dri/* +fi +msg_ok "Set Up Hardware Acceleration" + +RELEASE=$(curl -s https://api.github.com/repos/blakeblackshear/frigate/releases/latest | jq -r '.tag_name') +msg_ok "Stop spinner to prevent segmentation fault" +msg_info "Installing Frigate $RELEASE (Perseverance)" +if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi +cd ~ +mkdir -p /opt/frigate/models +wget -q https://github.com/blakeblackshear/frigate/archive/refs/tags/${RELEASE}.tar.gz -O frigate.tar.gz +tar -xzf frigate.tar.gz -C /opt/frigate --strip-components 1 +rm -rf frigate.tar.gz +cd /opt/frigate +$STD pip3 wheel --wheel-dir=/wheels -r /opt/frigate/docker/main/requirements-wheels.txt +cp -a /opt/frigate/docker/main/rootfs/. / +export TARGETARCH="amd64" +echo 'libc6 libraries/restart-without-asking boolean true' | debconf-set-selections +wget -q -O /opt/frigate/docker/main/install_deps.sh https://raw.githubusercontent.com/blakeblackshear/frigate/dev/docker/main/install_deps.sh +$STD /opt/frigate/docker/main/install_deps.sh +$STD ln -svf /usr/lib/btbn-ffmpeg/bin/ffmpeg /usr/local/bin/ffmpeg +$STD ln -svf /usr/lib/btbn-ffmpeg/bin/ffprobe /usr/local/bin/ffprobe +$STD pip3 install -U /wheels/*.whl +ldconfig +$STD pip3 install -r /opt/frigate/docker/main/requirements-dev.txt +$STD /opt/frigate/.devcontainer/initialize.sh +$STD make version +cd /opt/frigate/web +$STD npm install +$STD npm run build +cp -r /opt/frigate/web/dist/* /opt/frigate/web/ +cp -r /opt/frigate/config/. /config +sed -i '/^s6-svc -O \.$/s/^/#/' /opt/frigate/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run +cat </config/config.yml +mqtt: + enabled: false +cameras: + test: + ffmpeg: + #hwaccel_args: preset-vaapi + inputs: + - path: /media/frigate/person-bicycle-car-detection.mp4 + input_args: -re -stream_loop -1 -fflags +genpts + roles: + - detect + - rtmp + detect: + height: 1080 + width: 1920 + fps: 5 +EOF +ln -sf /config/config.yml /opt/frigate/config/config.yml +if [[ "$CTTYPE" == "0" ]]; then + sed -i -e 's/^kvm:x:104:$/render:x:104:root,frigate/' -e 's/^render:x:105:root$/kvm:x:105:/' /etc/group +else + sed -i -e 's/^kvm:x:104:$/render:x:104:frigate/' -e 's/^render:x:105:$/kvm:x:105:/' /etc/group +fi +echo "tmpfs /tmp/cache tmpfs defaults 0 0" >> /etc/fstab +msg_ok "Installed Frigate $RELEASE" + +if grep -q -o -m1 'avx[^ ]*' /proc/cpuinfo; then + msg_ok "AVX Support Detected" + msg_info "Installing Openvino Object Detection Model (Resilience)" + $STD pip install -r /opt/frigate/docker/main/requirements-ov.txt + cd /opt/frigate/models + export ENABLE_ANALYTICS=NO + $STD /usr/local/bin/omz_downloader --name ssdlite_mobilenet_v2 --num_attempts 2 + $STD /usr/local/bin/omz_converter --name ssdlite_mobilenet_v2 --precision FP16 --mo /usr/local/bin/mo + cd / + cp -r /opt/frigate/models/public/ssdlite_mobilenet_v2 openvino-model + wget -q https://github.com/openvinotoolkit/open_model_zoo/raw/master/data/dataset_classes/coco_91cl_bkgr.txt -O openvino-model/coco_91cl_bkgr.txt + sed -i 's/truck/car/g' openvino-model/coco_91cl_bkgr.txt + cat <>/config/config.yml +detectors: + ov: + type: openvino + device: AUTO + model: + path: /openvino-model/FP16/ssdlite_mobilenet_v2.xml +model: + width: 300 + height: 300 + input_tensor: nhwc + input_pixel_format: bgr + labelmap_path: /openvino-model/coco_91cl_bkgr.txt +EOF + msg_ok "Installed Openvino Object Detection Model" +else + cat <>/config/config.yml +model: + path: /cpu_model.tflite +EOF +fi + +msg_info "Installing Coral Object Detection Model (Patience)" +cd /opt/frigate +export CCACHE_DIR=/root/.ccache +export CCACHE_MAXSIZE=2G +wget -q https://github.com/libusb/libusb/archive/v1.0.26.zip +unzip -q v1.0.26.zip +rm v1.0.26.zip +cd libusb-1.0.26 +$STD ./bootstrap.sh +$STD ./configure --disable-udev --enable-shared +$STD make -j $(nproc --all) +cd /opt/frigate/libusb-1.0.26/libusb +mkdir -p /usr/local/lib +$STD /bin/bash ../libtool --mode=install /usr/bin/install -c libusb-1.0.la '/usr/local/lib' +mkdir -p /usr/local/include/libusb-1.0 +$STD /usr/bin/install -c -m 644 libusb.h '/usr/local/include/libusb-1.0' +ldconfig +cd / +wget -qO edgetpu_model.tflite https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite +wget -qO cpu_model.tflite https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess.tflite +cp /opt/frigate/labelmap.txt /labelmap.txt +wget -qO yamnet-tflite-classification-tflite-v1.tar.gz https://www.kaggle.com/api/v1/models/google/yamnet/tfLite/classification-tflite/1/download +tar xzf yamnet-tflite-classification-tflite-v1.tar.gz +rm -rf yamnet-tflite-classification-tflite-v1.tar.gz +mv 1.tflite cpu_audio_model.tflite +cp /opt/frigate/audio-labelmap.txt /audio-labelmap.txt +mkdir -p /media/frigate +wget -qO /media/frigate/person-bicycle-car-detection.mp4 https://github.com/intel-iot-devkit/sample-videos/raw/master/person-bicycle-car-detection.mp4 +msg_ok "Installed Coral Object Detection Model" + +msg_info "Building Nginx with Custom Modules" +$STD /opt/frigate/docker/main/build_nginx.sh +sed -i 's/exec nginx/exec \/usr\/local\/nginx\/sbin\/nginx/g' /opt/frigate/docker/main/rootfs/etc/s6-overlay/s6-rc.d/nginx/run +sed -i 's/error_log \/dev\/stdout warn\;/error_log \/dev\/shm\/logs\/nginx\/current warn\;/' /usr/local/nginx/conf/nginx.conf +sed -i 's/access_log \/dev\/stdout main\;/access_log \/dev\/shm\/logs\/nginx\/current main\;/' /usr/local/nginx/conf/nginx.conf +msg_ok "Built Nginx" + +msg_info "Creating Services" +cat </etc/systemd/system/create_directories.service +[Unit] +Description=Create necessary directories for logs + +[Service] +Type=oneshot +ExecStart=/bin/bash -c '/bin/mkdir -p /dev/shm/logs/{frigate,go2rtc,nginx} && /bin/touch /dev/shm/logs/{frigate/current,go2rtc/current,nginx/current} && /bin/chmod -R 777 /dev/shm/logs' + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now create_directories +sleep 3 +cat </etc/systemd/system/go2rtc.service +[Unit] +Description=go2rtc service +After=network.target +After=create_directories.service +StartLimitIntervalSec=0 + +[Service] +Type=simple +Restart=always +RestartSec=1 +User=root +ExecStartPre=+rm /dev/shm/logs/go2rtc/current +ExecStart=bash /opt/frigate/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run +StandardOutput=file:/dev/shm/logs/go2rtc/current +StandardError=file:/dev/shm/logs/go2rtc/current + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now go2rtc +sleep 3 +cat </etc/systemd/system/frigate.service +[Unit] +Description=Frigate service +After=go2rtc.service +After=create_directories.service +StartLimitIntervalSec=0 + +[Service] +Type=simple +Restart=always +RestartSec=1 +User=root +ExecStartPre=+rm /dev/shm/logs/frigate/current +ExecStart=bash /opt/frigate/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run +StandardOutput=file:/dev/shm/logs/frigate/current +StandardError=file:/dev/shm/logs/frigate/current + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now frigate +sleep 3 +cat </etc/systemd/system/nginx.service +[Unit] +Description=Nginx service +After=frigate.service +After=create_directories.service +StartLimitIntervalSec=0 + +[Service] +Type=simple +Restart=always +RestartSec=1 +User=root +ExecStartPre=+rm /dev/shm/logs/nginx/current +ExecStart=bash /opt/frigate/docker/main/rootfs/etc/s6-overlay/s6-rc.d/nginx/run +StandardOutput=file:/dev/shm/logs/nginx/current +StandardError=file:/dev/shm/logs/nginx/current + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now nginx +msg_ok "Configured Services" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/go2rtc-install.sh b/install/go2rtc-install.sh new file mode 100644 index 00000000..8c5f1072 --- /dev/null +++ b/install/go2rtc-install.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing go2rtc" +mkdir -p /opt/go2rtc +cd /opt/go2rtc +wget -q https://github.com/AlexxIT/go2rtc/releases/latest/download/go2rtc_linux_amd64 +chmod +x go2rtc_linux_amd64 +msg_ok "Installed go2rtc" + +msg_info "Creating Service" +service_path="/etc/systemd/system/go2rtc.service" +echo "[Unit] +Description=go2rtc service +After=network.target + +[Service] +Type=simple +User=root +ExecStart=/opt/go2rtc/go2rtc_linux_amd64 + +[Install] +WantedBy=multi-user.target" >$service_path +systemctl enable -q --now go2rtc +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/gokapi-install.sh b/install/gokapi-install.sh new file mode 100644 index 00000000..26fe6338 --- /dev/null +++ b/install/gokapi-install.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Gokapi" +LATEST=$(curl -sL https://api.github.com/repos/Forceu/Gokapi/releases/latest | grep '"tag_name":' | cut -d'"' -f4) +mkdir -p /opt/gokapi/{data,config} +wget -q https://github.com/Forceu/Gokapi/releases/download/$LATEST/gokapi-linux_amd64.zip +unzip -q gokapi-linux_amd64.zip -d /opt/gokapi +rm gokapi-linux_amd64.zip +chmod +x /opt/gokapi/gokapi-linux_amd64 +msg_ok "Installed Gokapi" + +msg_info "Creating Service" +cat </etc/systemd/system/gokapi.service +[Unit] +Description=gokapi + +[Service] +Type=simple +Environment=GOKAPI_DATA_DIR=/opt/gokapi/data +Environment=GOKAPI_CONFIG_DIR=/opt/gokapi/config +ExecStart=/opt/gokapi/gokapi-linux_amd64 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now gokapi +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/gotify-install.sh b/install/gotify-install.sh new file mode 100644 index 00000000..674013f8 --- /dev/null +++ b/install/gotify-install.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Gotify" +RELEASE=$(curl -s https://api.github.com/repos/gotify/server/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +mkdir -p /opt/gotify +cd /opt/gotify +wget -q https://github.com/gotify/server/releases/download/v${RELEASE}/gotify-linux-amd64.zip +$STD unzip gotify-linux-amd64.zip +rm -rf gotify-linux-amd64.zip +chmod +x gotify-linux-amd64 + +cat </etc/systemd/system/gotify.service +[Unit] +Description=Gotify +Requires=network.target +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/gotify +ExecStart=/opt/gotify/./gotify-linux-amd64 +Restart=always +RestartSec=3 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now gotify +msg_ok "Installed Gotify" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/grafana-install.sh b/install/grafana-install.sh new file mode 100644 index 00000000..88627730 --- /dev/null +++ b/install/grafana-install.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gnupg +$STD apt-get install -y apt-transport-https +$STD apt-get install -y software-properties-common +msg_ok "Installed Dependencies" + +msg_info "Setting up Grafana Repository" +wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key +sh -c 'echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main" > /etc/apt/sources.list.d/grafana.list' +msg_ok "Set up Grafana Repository" + +msg_info "Installing Grafana" +$STD apt-get update +$STD apt-get install -y grafana +systemctl start grafana-server +systemctl enable --now -q grafana-server.service +msg_ok "Installed Grafana" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/grocy-install.sh b/install/grocy-install.sh new file mode 100644 index 00000000..e47eb8bc --- /dev/null +++ b/install/grocy-install.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y apt-transport-https +msg_ok "Installed Dependencies" + +msg_info "Installing PHP8.2" +VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)" +curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg +echo -e "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $VERSION main" >/etc/apt/sources.list.d/php.list +$STD apt-get update +$STD apt-get install -y php8.2 +$STD apt-get install -y libapache2-mod-php8.2 +$STD apt-get install -y php8.2-sqlite3 +$STD apt-get install -y php8.2-gd +$STD apt-get install -y php8.2-intl +$STD apt-get install -y php8.2-mbstring +msg_ok "Installed PHP8.2" + +msg_info "Installing grocy" +latest=$(curl -s https://api.github.com/repos/grocy/grocy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +wget -q https://github.com/grocy/grocy/releases/download/v${latest}/grocy_${latest}.zip +$STD unzip grocy_${latest}.zip -d /var/www/html +chown -R www-data:www-data /var/www/html +cp /var/www/html/config-dist.php /var/www/html/data/config.php +chmod +x /var/www/html/update.sh + +cat </etc/apache2/sites-available/grocy.conf + + ServerAdmin webmaster@localhost + DocumentRoot /var/www/html/public + ErrorLog /var/log/apache2/error.log + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + allow from all + + +EOF + +$STD a2dissite 000-default.conf +$STD a2ensite grocy.conf +$STD a2enmod rewrite +systemctl reload apache2 +msg_ok "Installed grocy" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +rm -rf /root/grocy_${latest}.zip +msg_ok "Cleaned" diff --git a/install/headscale-install.sh b/install/headscale-install.sh new file mode 100644 index 00000000..cead9fb7 --- /dev/null +++ b/install/headscale-install.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +RELEASE=$(curl -s https://api.github.com/repos/juanfont/headscale/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +msg_info "Installing ${APPLICATION} v${RELEASE}" +wget -q https://github.com/juanfont/headscale/releases/download/v${RELEASE}/headscale_${RELEASE}_linux_amd64.deb +$STD dpkg -i headscale_${RELEASE}_linux_amd64.deb +systemctl enable -q --now headscale +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed ${APPLICATION} v${RELEASE}" + +motd_ssh +customize + +msg_info "Cleaning up" +rm headscale_${RELEASE}_linux_amd64.deb +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/heimdall-dashboard-install.sh b/install/heimdall-dashboard-install.sh new file mode 100644 index 00000000..951bef8b --- /dev/null +++ b/install/heimdall-dashboard-install.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y apt-transport-https +$STD apt-get install -y composer +$STD apt-get install -y php8.2-{bz2,curl,sqlite3,zip,xml} +msg_ok "Installed Dependencies" + +RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/Heimdall/releases/latest" | awk '/tag_name/{print $4;exit}' FS='[""]') +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_info "Installing Heimdall Dashboard ${RELEASE}" +wget -q https://github.com/linuxserver/Heimdall/archive/${RELEASE}.tar.gz +tar xzf ${RELEASE}.tar.gz +VER=$(curl -s https://api.github.com/repos/linuxserver/Heimdall/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +rm -rf ${RELEASE}.tar.gz +mv Heimdall-${VER} /opt/Heimdall +cd /opt/Heimdall +cp .env.example .env +$STD php artisan key:generate +msg_ok "Installed Heimdall Dashboard ${RELEASE}" + +msg_info "Creating Service" +service_path="/etc/systemd/system/heimdall.service" +echo "[Unit] +Description=Heimdall +After=network.target + +[Service] +Restart=always +RestartSec=5 +Type=simple +User=root +WorkingDirectory=/opt/Heimdall +ExecStart="/usr/bin/php" artisan serve --port 7990 --host 0.0.0.0 +TimeoutStopSec=30 + +[Install] +WantedBy=multi-user.target" >$service_path +systemctl enable -q --now heimdall.service +cd /opt/Heimdall +COMPOSER_ALLOW_SUPERUSER=1 composer dump-autoload &>/dev/null +systemctl restart heimdall.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/hivemq-install.sh b/install/hivemq-install.sh new file mode 100644 index 00000000..5234a49b --- /dev/null +++ b/install/hivemq-install.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +msg_ok "Installed Dependencies" + +msg_info "Installing OpenJDK" +wget -qO- https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor >/etc/apt/trusted.gpg.d/adoptium.gpg +echo 'deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/adoptium.gpg] https://packages.adoptium.net/artifactory/deb bookworm main' >/etc/apt/sources.list.d/adoptium.list +$STD apt-get update +$STD apt-get install -y temurin-17-jre +msg_ok "Installed OpenJDK" + +msg_info "Installing HiveMQ CE" +RELEASE=$(curl -s https://api.github.com/repos/hivemq/hivemq-community-edition/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +wget -q https://github.com/hivemq/hivemq-community-edition/releases/download/${RELEASE}/hivemq-ce-${RELEASE}.zip +unzip -q hivemq-ce-${RELEASE}.zip +mkdir -p /opt/hivemq +mv hivemq-ce-${RELEASE}/* /opt/hivemq +useradd -d /opt/hivemq hivemq +chown -R hivemq:hivemq /opt/hivemq +chmod +x /opt/hivemq/bin/run.sh +cp /opt/hivemq/bin/init-script/hivemq.service /etc/systemd/system/hivemq.service +rm /opt/hivemq/conf/config.xml +mv /opt/hivemq/conf/examples/configuration/config-sample-tcp-and-websockets.xml /opt/hivemq/conf/config.xml +systemctl enable -q --now hivemq +msg_ok "Installed HiveMQ CE" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf hivemq-ce-${RELEASE}.zip +rm -rf ../hivemq-ce-${RELEASE} +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/homarr-install.sh b/install/homarr-install.sh new file mode 100644 index 00000000..c1dcf22e --- /dev/null +++ b/install/homarr-install.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y ca-certificates +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js/Yarn" +$STD apt-get update +$STD apt-get install -y nodejs +$STD npm install -g npm@latest +$STD npm install -g yarn +msg_ok "Installed Node.js/Yarn" + +msg_info "Installing Homarr (Patience)" +$STD git clone -b dev https://github.com/ajnart/homarr.git /opt/homarr +cat </opt/homarr/.env +DATABASE_URL="file:./database/db.sqlite" +NEXTAUTH_URL="http://localhost:3000" +NEXTAUTH_SECRET="$(openssl rand -base64 32)" +NEXT_PUBLIC_DISABLE_ANALYTICS="true" +DEFAULT_COLOR_SCHEME="dark" +EOF +cd /opt/homarr +$STD yarn install +$STD yarn build +$STD yarn db:migrate +msg_ok "Installed Homarr" + +msg_info "Creating Service" +cat </etc/systemd/system/homarr.service +[Unit] +Description=Homarr Service +After=network.target + +[Service] +Type=exec +WorkingDirectory=/opt/homarr +EnvironmentFile=-/opt/homarr/.env +ExecStart=/usr/bin/yarn start + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now homarr.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/homeassistant-core-install.sh b/install/homeassistant-core-install.sh new file mode 100644 index 00000000..abaee900 --- /dev/null +++ b/install/homeassistant-core-install.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get install -y {git,curl,sudo,mc,bluez,libffi-dev,libssl-dev,libjpeg-dev,zlib1g-dev,autoconf,build-essential,libopenjp2-7,libturbojpeg0-dev,ffmpeg,liblapack3,liblapack-dev,dbus-broker,libpcap-dev,libavdevice-dev,libavformat-dev,libavcodec-dev,libavutil-dev,libavfilter-dev,libmariadb-dev-compat,libatlas-base-dev,python3-pip,python3.12-venv} +msg_ok "Installed Dependencies" + +msg_info "Installing Home Assistant-Core" +mkdir /srv/homeassistant +cd /srv/homeassistant +python3 -m venv . +source bin/activate +$STD pip install webrtcvad +$STD python3 -m pip install wheel +$STD pip install homeassistant +$STD pip install mysqlclient +$STD pip install psycopg2-binary +mkdir -p /root/.homeassistant +msg_ok "Installed Home Assistant-Core" + +msg_info "Creating Service" +cat </etc/systemd/system/homeassistant.service +[Unit] +Description=Home Assistant +After=network-online.target +[Service] +Type=simple +WorkingDirectory=/root/.homeassistant +ExecStart=/srv/homeassistant/bin/hass -c "/root/.homeassistant" +Restart=always +RestartForceExitStatus=100 +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now homeassistant +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/homeassistant-install.sh b/install/homeassistant-install.sh new file mode 100644 index 00000000..088fc4d3 --- /dev/null +++ b/install/homeassistant-install.sh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Updating Python3" +$STD apt-get install -y \ + python3 \ + python3-dev \ + python3-pip \ + python3-venv +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Updated Python3" + +msg_info "Installing runlike" +$STD pip install runlike +msg_ok "Installed runlike" + +get_latest_release() { + curl -sL https://api.github.com/repos/$1/releases/latest | grep '"tag_name":' | cut -d'"' -f4 +} + +DOCKER_LATEST_VERSION=$(get_latest_release "moby/moby") +CORE_LATEST_VERSION=$(get_latest_release "home-assistant/core") +PORTAINER_LATEST_VERSION=$(get_latest_release "portainer/portainer") + +msg_info "Installing Docker $DOCKER_LATEST_VERSION" +DOCKER_CONFIG_PATH='/etc/docker/daemon.json' +mkdir -p $(dirname $DOCKER_CONFIG_PATH) +echo -e '{\n "log-driver": "journald"\n}' >/etc/docker/daemon.json +$STD sh <(curl -sSL https://get.docker.com) +msg_ok "Installed Docker $DOCKER_LATEST_VERSION" + +msg_info "Pulling Portainer $PORTAINER_LATEST_VERSION Image" +$STD docker pull portainer/portainer-ce:latest +msg_ok "Pulled Portainer $PORTAINER_LATEST_VERSION Image" + +msg_info "Installing Portainer $PORTAINER_LATEST_VERSION" +$STD docker volume create portainer_data +$STD docker run -d \ + -p 8000:8000 \ + -p 9443:9443 \ + --name=portainer \ + --restart=always \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v portainer_data:/data \ + portainer/portainer-ce:latest +msg_ok "Installed Portainer $PORTAINER_LATEST_VERSION" + +msg_info "Pulling Home Assistant $CORE_LATEST_VERSION Image" +$STD docker pull ghcr.io/home-assistant/home-assistant:stable +msg_ok "Pulled Home Assistant $CORE_LATEST_VERSION Image" + +msg_info "Installing Home Assistant $CORE_LATEST_VERSION" +$STD docker volume create hass_config +$STD docker run -d \ + --name homeassistant \ + --privileged \ + --restart unless-stopped \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v /dev:/dev \ + -v hass_config:/config \ + -v /etc/localtime:/etc/localtime:ro \ + --net=host \ + ghcr.io/home-assistant/home-assistant:stable +mkdir /root/hass_config +msg_ok "Installed Home Assistant $CORE_LATEST_VERSION" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/homebridge-install.sh b/install/homebridge-install.sh new file mode 100644 index 00000000..76ac86fc --- /dev/null +++ b/install/homebridge-install.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y avahi-daemon +$STD apt-get install -y gnupg2 +msg_ok "Installed Dependencies" + +msg_info "Setting up Homebridge Repository" +curl -sSf https://repo.homebridge.io/KEY.gpg | gpg --dearmor >/etc/apt/trusted.gpg.d/homebridge.gpg +echo 'deb [signed-by=/etc/apt/trusted.gpg.d/homebridge.gpg] https://repo.homebridge.io stable main' >/etc/apt/sources.list.d/homebridge.list +msg_ok "Set up Homebridge Repository" + +msg_info "Installing Homebridge" +$STD apt update +$STD apt-get install -y homebridge +msg_ok "Installed Homebridge" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/homepage-install.sh b/install/homepage-install.sh new file mode 100644 index 00000000..3221324f --- /dev/null +++ b/install/homepage-install.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +$STD npm install -g pnpm +msg_ok "Installed Node.js" + +RELEASE=$(curl -s https://api.github.com/repos/gethomepage/homepage/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +msg_info "Installing Homepage v${RELEASE} (Patience)" +wget -q https://github.com/gethomepage/homepage/archive/refs/tags/v${RELEASE}.tar.gz +$STD tar -xzf v${RELEASE}.tar.gz +rm -rf v${RELEASE}.tar.gz +mkdir -p /opt/homepage/config +mv homepage-${RELEASE}/* /opt/homepage +rm -rf homepage-${RELEASE} +cd /opt/homepage +cp /opt/homepage/src/skeleton/* /opt/homepage/config +$STD pnpm install +$STD pnpm build +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed Homepage v${RELEASE}" + +msg_info "Creating Service" +cat </etc/systemd/system/homepage.service +[Unit] +Description=Homepage +After=network.target +StartLimitIntervalSec=0 +[Service] +Type=simple +Restart=always +RestartSec=1 +User=root +WorkingDirectory=/opt/homepage/ +ExecStart=pnpm start +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now homepage +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/homer-install.sh b/install/homer-install.sh new file mode 100644 index 00000000..cab3080c --- /dev/null +++ b/install/homer-install.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y pip +msg_ok "Installed Dependencies" + +msg_info "Installing Homer" +mkdir -p /opt/homer +cd /opt/homer +wget -q https://github.com/bastienwirtz/homer/releases/latest/download/homer.zip +$STD unzip homer.zip +rm -rf homer.zip +cp assets/config.yml.dist assets/config.yml +msg_ok "Installed Homer" + +msg_info "Creating Service" +cat </etc/systemd/system/homer.service +[Unit] +Description=Homer Dashboard +After=network-online.target +[Service] +Type=simple +WorkingDirectory=/opt/homer +ExecStart=python3 -m http.server 8010 +[Install] +WantedBy=multi-user.target +EOF +$STD systemctl enable --now homer +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/hyperhdr-install.sh b/install/hyperhdr-install.sh new file mode 100644 index 00000000..05759f54 --- /dev/null +++ b/install/hyperhdr-install.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +msg_ok "Installed Dependencies" + +msg_info "Installing HyperHDR" +curl -fsSL https://awawa-dev.github.io/hyperhdr.public.apt.gpg.key >/usr/share/keyrings/hyperhdr.public.apt.gpg.key +chmod go+r /usr/share/keyrings/hyperhdr.public.apt.gpg.key +echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hyperhdr.public.apt.gpg.key] https://awawa-dev.github.io $(awk -F= '/VERSION_CODENAME/ {print $2}' /etc/os-release) main" >/etc/apt/sources.list.d/hyperhdr.list +$STD apt-get update +$STD apt-get install -y hyperhdr +msg_ok "Installed HyperHDR" + +msg_info "Creating Service" +cat </etc/systemd/system/hyperhdr.service +[Unit] +Description=HyperHDR Service +After=syslog.target network.target + +[Service] +Restart=on-failure +RestartSec=5 +Type=simple +ExecStart=/usr/bin/hyperhdr + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now hyperhdr +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/hyperion-install.sh b/install/hyperion-install.sh new file mode 100644 index 00000000..3ac24e5a --- /dev/null +++ b/install/hyperion-install.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y lsb-release +$STD apt-get install -y gpg +$STD apt-get install -y apt-transport-https +$STD apt-get install -y libpython3.11 + +msg_ok "Installed Dependencies" + +msg_info "Installing Hyperion" +wget -qO- https://releases.hyperion-project.org/hyperion.pub.key | gpg --dearmor -o /usr/share/keyrings/hyperion.pub.gpg +echo "deb [signed-by=/usr/share/keyrings/hyperion.pub.gpg] https://apt.releases.hyperion-project.org/ $(lsb_release -cs) main" >/etc/apt/sources.list.d/hyperion.list +$STD apt-get update +$STD apt-get install -y hyperion +$STD systemctl enable --now hyperion@root.service +msg_ok "Installed Hyperion" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get autoremove >/dev/null +$STD apt-get autoclean >/dev/null +msg_ok "Cleaned" diff --git a/install/influxdb-install.sh b/install/influxdb-install.sh new file mode 100644 index 00000000..a1edf820 --- /dev/null +++ b/install/influxdb-install.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y lsb-base +$STD apt-get install -y lsb-release +$STD apt-get install -y gnupg2 +msg_ok "Installed Dependencies" + +msg_info "Setting up InfluxDB Repository" +wget -qO- https://repos.influxdata.com/influxdata-archive_compat.key | gpg --dearmor > /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg +echo "deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg] https://repos.influxdata.com/debian stable main" > /etc/apt/sources.list.d/influxdata.list +msg_ok "Set up InfluxDB Repository" + +read -r -p "Which version of InfluxDB to install? (1 or 2) " prompt +if [[ $prompt == "2" ]]; then + INFLUX="2" +else + INFLUX="1" +fi + +msg_info "Installing InfluxDB" +$STD apt-get update +if [[ $INFLUX == "2" ]]; then + $STD apt-get install -y influxdb2 +else + $STD apt-get install -y influxdb + wget -q https://dl.influxdata.com/chronograf/releases/chronograf_1.10.1_amd64.deb + $STD dpkg -i chronograf_1.10.1_amd64.deb +fi +$STD systemctl enable --now influxdb +msg_ok "Installed InfluxDB" + +read -r -p "Would you like to add Telegraf? " prompt +if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + msg_info "Installing Telegraf" + $STD apt-get install -y telegraf + msg_ok "Installed Telegraf" +fi + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/iobroker-install.sh b/install/iobroker-install.sh new file mode 100644 index 00000000..8673c135 --- /dev/null +++ b/install/iobroker-install.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y ca-certificates +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing ioBroker (Patience)" +$STD bash <(curl -fsSL https://iobroker.net/install.sh) +msg_ok "Installed ioBroker" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/iventoy-install.sh b/install/iventoy-install.sh new file mode 100644 index 00000000..ea58b59d --- /dev/null +++ b/install/iventoy-install.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +RELEASE=$(curl -s https://api.github.com/repos/ventoy/pxe/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +msg_info "Installing iVentoy v${RELEASE}" +mkdir -p /opt/iventoy/{data,iso} +wget -q https://github.com/ventoy/PXE/releases/download/v${RELEASE}/iventoy-${RELEASE}-linux-free.tar.gz +tar -C /tmp -xzf iventoy*.tar.gz +mv /tmp/iventoy*/* /opt/iventoy/ +rm -rf iventoy*.tar.gz +msg_ok "Installed iVentoy" + +msg_info "Creating Service" +cat </etc/systemd/system/iventoy.service +[Unit] +Description=iVentoy PXE Booter +Documentation=https://www.iventoy.com +Wants=network-online.target +[Service] +Type=forking +Environment=IVENTOY_API_ALL=1 +Environment=IVENTOY_AUTO_RUN=1 +Environment=LIBRARY_PATH=/opt/iventoy/lib/lin64 +Environment=LD_LIBRARY_PATH=/opt/iventoy/lib/lin64 +ExecStart=sh ./iventoy.sh -R start +WorkingDirectory=/opt/iventoy +Restart=on-failure +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now iventoy.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/jackett-install.sh b/install/jackett-install.sh new file mode 100644 index 00000000..8dd59167 --- /dev/null +++ b/install/jackett-install.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Jackett" +RELEASE=$(wget -q https://github.com/Jackett/Jackett/releases/latest -O - | grep "title>Release" | cut -d " " -f 4) +wget -q https://github.com/Jackett/Jackett/releases/download/$RELEASE/Jackett.Binaries.LinuxAMDx64.tar.gz +tar -xzf Jackett.Binaries.LinuxAMDx64.tar.gz -C /opt +rm -rf Jackett.Binaries.LinuxAMDx64.tar.gz +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed Jackett" + +msg_info "Creating Service" +cat </etc/systemd/system/jackett.service +[Unit] +Description=Jackett Daemon +After=network.target +[Service] +SyslogIdentifier=jackett +Restart=always +RestartSec=5 +Type=simple +WorkingDirectory=/opt/Jackett +ExecStart=/bin/sh /opt/Jackett/jackett_launcher.sh +TimeoutStopSec=30 +Environment="DisableRootWarning=true" +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now jackett.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/jellyfin-install.sh b/install/jellyfin-install.sh new file mode 100644 index 00000000..0b91e060 --- /dev/null +++ b/install/jellyfin-install.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y gnupg +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Setting Up Hardware Acceleration" +$STD apt-get -y install {va-driver-all,ocl-icd-libopencl1,intel-opencl-icd,vainfo,intel-gpu-tools} +if [[ "$CTTYPE" == "0" ]]; then + chgrp video /dev/dri + chmod 755 /dev/dri + chmod 660 /dev/dri/* + $STD adduser $(id -u -n) video + $STD adduser $(id -u -n) render +fi +msg_ok "Set Up Hardware Acceleration" + +msg_info "Installing Jellyfin" +VERSION="$( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release )" +# If the keyring directory is absent, create it +if [[ ! -d /etc/apt/keyrings ]]; then + mkdir -p /etc/apt/keyrings +fi +# Download the repository signing key and install it to the keyring directory +curl -fsSL https://repo.jellyfin.org/jellyfin_team.gpg.key | gpg --dearmor --yes --output /etc/apt/keyrings/jellyfin.gpg +# Install the Deb822 format jellyfin.sources entry +cat </etc/apt/sources.list.d/jellyfin.sources +Types: deb +URIs: https://repo.jellyfin.org/${PCT_OSTYPE} +Suites: ${VERSION} +Components: main +Architectures: amd64 +Signed-By: /etc/apt/keyrings/jellyfin.gpg +EOF +# Install Jellyfin using the metapackage (which will fetch jellyfin-server, jellyfin-web, and jellyfin-ffmpeg5) +$STD apt-get update +$STD apt-get install -y jellyfin +if [[ "$CTTYPE" == "0" ]]; then + sed -i -e 's/^ssl-cert:x:104:$/render:x:104:root,jellyfin/' -e 's/^render:x:108:root,jellyfin$/ssl-cert:x:108:/' /etc/group +else + sed -i -e 's/^ssl-cert:x:104:$/render:x:104:jellyfin/' -e 's/^render:x:108:jellyfin$/ssl-cert:x:108:/' /etc/group +fi +msg_ok "Installed Jellyfin" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/jellyseerr-install.sh b/install/jellyseerr-install.sh new file mode 100644 index 00000000..38ae8b22 --- /dev/null +++ b/install/jellyseerr-install.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y ca-certificates +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing Yarn" +$STD npm install -g yarn +msg_ok "Installed Yarn" + +msg_info "Installing Jellyseerr (Patience)" +git clone -q https://github.com/Fallenbagel/jellyseerr.git /opt/jellyseerr +cd /opt/jellyseerr +$STD git checkout main +CYPRESS_INSTALL_BINARY=0 yarn install --frozen-lockfile --network-timeout 1000000 &>/dev/null +$STD yarn install +$STD yarn build +mkdir -p /etc/jellyseerr/ +cat </etc/jellyseerr/jellyseerr.conf +PORT=5055 +# HOST=0.0.0.0 +# JELLYFIN_TYPE=emby +EOF +msg_ok "Installed Jellyseerr" + +msg_info "Creating Service" +cat </etc/systemd/system/jellyseerr.service +[Unit] +Description=jellyseerr Service +After=network.target + +[Service] +EnvironmentFile=/etc/jellyseerr/jellyseerr.conf +Environment=NODE_ENV=production +Type=exec +WorkingDirectory=/opt/jellyseerr +ExecStart=/usr/bin/yarn start + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now jellyseerr.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/k0s-install.sh b/install/k0s-install.sh new file mode 100644 index 00000000..8ad44b52 --- /dev/null +++ b/install/k0s-install.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +msg_ok "Installed Dependencies" + +msg_info "Installing k0s Kubernetes" +$STD bash <(curl -sSLf https://get.k0s.sh) +$STD k0s install controller --single +$STD k0s start +mkdir -p /etc/k0s +k0s config create > /etc/k0s/k0s.yaml +msg_ok "Installed k0s Kubernetes" + +read -r -p "Would you like to add Helm Package Manager? " prompt +if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then +msg_info "Installing Helm" +$STD bash <(curl -sSLf https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3) +msg_ok "Installed Helm" +fi +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/kavita-install.sh b/install/kavita-install.sh new file mode 100644 index 00000000..b354f171 --- /dev/null +++ b/install/kavita-install.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Kavita" +cd /opt +RELEASE=$(curl -s https://api.github.com/repos/Kareadita/Kavita/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +$STD tar -xvzf <(curl -fsSL https://github.com/Kareadita/Kavita/releases/download/$RELEASE/kavita-linux-x64.tar.gz) --no-same-owner +msg_ok "Installed Kavita" + +msg_info "Creating Service" +service_path="/etc/systemd/system/kavita.service" +echo "[Unit] +Description=Kavita Server +After=network.target + +[Service] +Type=simple +WorkingDirectory=/opt/Kavita +ExecStart=/opt/Kavita/Kavita +TimeoutStopSec=20 +KillMode=process +Restart=on-failure + +[Install] +WantedBy=multi-user.target" >$service_path +chmod +x /opt/Kavita/* && chown root /opt/Kavita/* +systemctl enable --now -q kavita.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/keycloak-install.sh b/install/keycloak-install.sh new file mode 100644 index 00000000..536a2bb8 --- /dev/null +++ b/install/keycloak-install.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get install -y curl +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y ca-certificates-java +$STD apt-get install -y openjdk-17-jre-headless +msg_ok "Installed Dependencies" + +RELEASE=$(curl -s https://api.github.com/repos/keycloak/keycloak/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +msg_info "Installing Keycloak v$RELEASE" +cd /opt +wget -q https://github.com/keycloak/keycloak/releases/download/$RELEASE/keycloak-$RELEASE.tar.gz +$STD tar -xvf keycloak-$RELEASE.tar.gz +mv keycloak-$RELEASE keycloak +msg_ok "Installed Keycloak" + +msg_info "Creating Service" +service_path="/etc/systemd/system/keycloak.service" +echo "[Unit] +Description=Keycloak +After=network-online.target +[Service] +User=root +WorkingDirectory=/opt/keycloak +ExecStart=/opt/keycloak/bin/kc.sh start-dev +[Install] +WantedBy=multi-user.target" >$service_path +$STD systemctl enable --now keycloak.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/kubo-install.sh b/install/kubo-install.sh new file mode 100644 index 00000000..390674c1 --- /dev/null +++ b/install/kubo-install.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: ulmentflam +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +msg_ok "Installed Dependencies" + +msg_info "Installing IPFS" +RELEASE=$(wget -q https://github.com/ipfs/kubo/releases/latest -O - | grep "title>Release" | cut -d " " -f 4) +$STD wget -q "https://github.com/ipfs/kubo/releases/download/${RELEASE}/kubo_${RELEASE}_linux-amd64.tar.gz" +tar -xzf "kubo_${RELEASE}_linux-amd64.tar.gz" -C /usr/local +$STD ln -s /usr/local/kubo/ipfs /usr/local/bin/ipfs +$STD ipfs init +ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001 +ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080 +LXCIP=$(hostname -I | awk '{print $1}') +ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://${LXCIP}:5001\", \"http://localhost:3000\", \"http://127.0.0.1:5001\", \"https://webui.ipfs.io\", \"http://0.0.0.0:5001\"]" +ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST"]' +echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" +$STD rm "kubo_${RELEASE}_linux-amd64.tar.gz" +msg_ok "Installed IPFS" + +msg_info "Creating Service" +cat </etc/systemd/system/ipfs.service +[Unit] +Description=IPFS Daemon +After=syslog.target network.target + +[Service] +Type=simple +ExecStart=/usr/local/bin/ipfs daemon +Restart=on-failure +[Install] +WantedBy=multi-user.target +EOF +systemctl enable --now -q ipfs.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/lazylibrarian-install.sh b/install/lazylibrarian-install.sh new file mode 100644 index 00000000..ce10041e --- /dev/null +++ b/install/lazylibrarian-install.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MountyMapleSyrup (MountyMapleSyrup) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +msg_ok "Installed Dependencies" + +msg_info "Installing Python3 Dependencies" +$STD apt-get install -y pip +$STD apt-get install -y python3-irc +$STD pip install jaraco.stream +$STD pip install python-Levenshtein +$STD pip install soupsieve +msg_ok "Installed Python3 Dependencies" + +msg_info "Installing LazyLibrarian" +$STD git clone https://gitlab.com/LazyLibrarian/LazyLibrarian /opt/LazyLibrarian +msg_ok "Installed LazyLibrarian" + +msg_info "Creating Service" +cat </etc/systemd/system/lazylibrarian.service +[Unit] +Description=LazyLibrarian Daemon +After=syslog.target network.target +[Service] +UMask=0002 +Type=simple +ExecStart=/usr/bin/python3 /opt/LazyLibrarian/LazyLibrarian.py +TimeoutStopSec=20 +KillMode=process +Restart=on-failure +[Install] +WantedBy=multi-user.target +EOF +systemctl enable --now -q lazylibrarian +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/lidarr-install.sh b/install/lidarr-install.sh new file mode 100644 index 00000000..0970ef18 --- /dev/null +++ b/install/lidarr-install.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y sqlite3 +$STD apt-get install -y libchromaprint-tools +$STD apt-get install -y mediainfo +msg_ok "Installed Dependencies" + +msg_info "Installing Lidarr" +mkdir -p /var/lib/lidarr/ +chmod 775 /var/lib/lidarr/ +$STD wget --content-disposition 'https://lidarr.servarr.com/v1/update/master/updatefile?os=linux&runtime=netcore&arch=x64' +$STD tar -xvzf Lidarr.master.*.tar.gz +mv Lidarr /opt +chmod 775 /opt/Lidarr +msg_ok "Installed Lidarr" + +msg_info "Creating Service" +cat </etc/systemd/system/lidarr.service +[Unit] +Description=Lidarr Daemon +After=syslog.target network.target +[Service] +UMask=0002 +Type=simple +ExecStart=/opt/Lidarr/Lidarr -nobrowser -data=/var/lib/lidarr/ +TimeoutStopSec=20 +KillMode=process +Restart=on-failure +[Install] +WantedBy=multi-user.target +EOF +systemctl -q daemon-reload +systemctl enable --now -q lidarr +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf Lidarr.master.*.tar.gz +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/linkwarden-install.sh b/install/linkwarden-install.sh new file mode 100644 index 00000000..9d5c455d --- /dev/null +++ b/install/linkwarden-install.sh @@ -0,0 +1,112 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y gpg +$STD apt-get install -y postgresql +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js/Yarn" +$STD apt-get update +$STD apt-get install -y nodejs +$STD npm install -g yarn +msg_ok "Installed Node.js/Yarn" + +msg_info "Clone Linkwarden Repository" +$STD git clone https://github.com/linkwarden/linkwarden.git /opt/linkwarden +cd /opt/linkwarden +msg_ok "Cloned Linkwarden Repository" + +msg_info "Setting up PostgreSQL DB" +DB_NAME=linkwardendb +DB_USER=linkwarden +DB_PASS="$(openssl rand -base64 18 | tr -d '/' | cut -c1-13)" +$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" +$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;" + +echo "" >>~/linkwarden.creds +echo -e "Linkwarden Database User: \e[32m$DB_USER\e[0m" >>~/linkwarden.creds +echo -e "Linkwarden Database Password: \e[32m$DB_PASS\e[0m" >>~/linkwarden.creds +echo -e "Linkwarden Database Name: \e[32m$DB_NAME\e[0m" >>~/linkwarden.creds +msg_ok "Set up PostgreSQL DB" + +read -r -p "Would you like to add Adminer? " prompt +if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + msg_info "Installing Adminer" + $STD apt install -y adminer + $STD a2enconf adminer + systemctl reload apache2 + IP=$(hostname -I | awk '{print $1}') + echo "" >>~/linkwarden.creds + echo -e "Adminer Interface: \e[32m$IP/adminer/\e[0m" >>~/linkwarden.creds + echo -e "Adminer System: \e[32mPostgreSQL\e[0m" >>~/linkwarden.creds + echo -e "Adminer Server: \e[32mlocalhost:5432\e[0m" >>~/linkwarden.creds + echo -e "Adminer Username: \e[32m$DB_USER\e[0m" >>~/linkwarden.creds + echo -e "Adminer Password: \e[32m$DB_PASS\e[0m" >>~/linkwarden.creds + echo -e "Adminer Database: \e[32m$DB_NAME\e[0m" >>~/linkwarden.creds + msg_ok "Installed Adminer" +fi + +msg_info "Installing Linkwarden (Patience)" +RELEASE=$(curl -s https://api.github.com/repos/linkwarden/linkwarden/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +$STD yarn +$STD npx playwright install-deps +IP=$(hostname -I | awk '{print $1}') +SECRET_KEY="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)" +env_path="/opt/linkwarden/.env" +echo " +NEXTAUTH_SECRET=${SECRET_KEY} +NEXTAUTH_URL=http://${IP}:3000 +DATABASE_URL=postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME} +" >$env_path +$STD yarn build +$STD yarn prisma migrate deploy +msg_ok "Installed Linkwarden" + +msg_info "Creating Service" +cat </etc/systemd/system/linkwarden.service +[Unit] +Description=Linkwarden Service +After=network.target + +[Service] +Type=exec +WorkingDirectory=/opt/linkwarden +ExecStart=/usr/bin/yarn start + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now linkwarden.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/mafl-install.sh b/install/mafl-install.sh new file mode 100644 index 00000000..da27b266 --- /dev/null +++ b/install/mafl-install.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y make +$STD apt-get install -y g++ +$STD apt-get install -y gcc +$STD apt-get install -y ca-certificates +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +$STD npm install -g npm@latest +$STD npm install -g yarn +msg_ok "Installed Node.js" + +RELEASE=$(curl -s https://api.github.com/repos/hywax/mafl/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +msg_info "Installing Mafl v${RELEASE}" +wget -q https://github.com/hywax/mafl/archive/refs/tags/v${RELEASE}.tar.gz +tar -xzf v${RELEASE}.tar.gz +mkdir -p /opt/mafl/data +wget -q -O /opt/mafl/data/config.yml https://raw.githubusercontent.com/hywax/mafl/main/.example/config.yml +mv mafl-${RELEASE}/* /opt/mafl +rm -rf mafl-${RELEASE} +cd /opt/mafl +export NUXT_TELEMETRY_DISABLED=true +$STD yarn install +$STD yarn build +msg_ok "Installed Mafl v${RELEASE}" + +msg_info "Creating Service" +cat </etc/systemd/system/mafl.service +[Unit] +Description=Mafl +After=network.target +StartLimitIntervalSec=0 + +[Service] +Type=simple +Restart=always +RestartSec=1 +User=root +WorkingDirectory=/opt/mafl/ +ExecStart=yarn preview + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now mafl +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/magicmirror-install.sh b/install/magicmirror-install.sh new file mode 100644 index 00000000..5ba0dff2 --- /dev/null +++ b/install/magicmirror-install.sh @@ -0,0 +1,161 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y ca-certificates +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Setting up MagicMirror Repository" +$STD git clone https://github.com/MichMich/MagicMirror /opt/magicmirror +msg_ok "Set up MagicMirror Repository" + +msg_info "Installing MagicMirror" +cd /opt/magicmirror +$STD npm install --only=prod --omit=dev + +cat </opt/magicmirror/config/config.js +let config = { + address: "0.0.0.0", + port: 8080, + basePath: "/", + ipWhitelist: [], + useHttps: false, + httpsPrivateKey: "", + httpsCertificate: "", + language: "en", + locale: "en-US", + logLevel: ["INFO", "LOG", "WARN", "ERROR"], + timeFormat: 24, + units: "metric", + serverOnly: true, + modules: [ + { + module: "alert", + }, + { + module: "updatenotification", + position: "top_bar" + }, + { + module: "clock", + position: "top_left" + }, + { + module: "calendar", + header: "US Holidays", + position: "top_left", + config: { + calendars: [ + { + symbol: "calendar-check", + url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics" + } + ] + } + }, + { + module: "compliments", + position: "lower_third" + }, + { + module: "weather", + position: "top_right", + config: { + weatherProvider: "openweathermap", + type: "current", + location: "New York", + locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city + apiKey: "YOUR_OPENWEATHER_API_KEY" + } + }, + { + module: "weather", + position: "top_right", + header: "Weather Forecast", + config: { + weatherProvider: "openweathermap", + type: "forecast", + location: "New York", + locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city + apiKey: "YOUR_OPENWEATHER_API_KEY" + } + }, + { + module: "newsfeed", + position: "bottom_bar", + config: { + feeds: [ + { + title: "New York Times", + url: "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml" + } + ], + showSourceTitle: true, + showPublishDate: true, + broadcastNewsFeeds: true, + broadcastNewsUpdates: true + } + }, + ] +}; + +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== "undefined") {module.exports = config;} +EOF +msg_ok "Installed MagicMirror" + +msg_info "Creating Service" +service_path="/etc/systemd/system/magicmirror.service" +echo "[Unit] +Description=Magic Mirror +After=network.target +StartLimitIntervalSec=0 + +[Service] +Type=simple +Restart=always +RestartSec=1 +User=root +WorkingDirectory=/opt/magicmirror/ +ExecStart=/usr/bin/node serveronly + +[Install] +WantedBy=multi-user.target" >$service_path +$STD systemctl enable --now magicmirror +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/mariadb-install.sh b/install/mariadb-install.sh new file mode 100644 index 00000000..46ecf9df --- /dev/null +++ b/install/mariadb-install.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing MariaDB" +$STD bash <(curl -fsSL https://r.mariadb.com/downloads/mariadb_repo_setup) +$STD apt-get update +$STD apt-get install -y mariadb-server +sed -i 's/^# *\(port *=.*\)/\1/' /etc/mysql/my.cnf +sed -i 's/^bind-address/#bind-address/g' /etc/mysql/mariadb.conf.d/50-server.cnf +msg_ok "Installed MariaDB" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/matterbridge-install.sh b/install/matterbridge-install.sh new file mode 100644 index 00000000..47948471 --- /dev/null +++ b/install/matterbridge-install.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +# Source: https://github.com/Luligu/matterbridge/ + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get install -y --no-install-recommends \ + build-essential \ + unzip \ + curl \ + sudo \ + git \ + make \ + gnupg \ + ca-certificates \ + mc +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Install Matterbridge" +RELEASE=$(curl -s https://api.github.com/repos/Luligu/matterbridge/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +wget -q "https://github.com/Luligu/matterbridge/archive/refs/tags/${RELEASE}.zip" +unzip -q ${RELEASE}.zip +mv matterbridge-${RELEASE} /opt/matterbridge +rm -R ${RELEASE}.zip +cd /opt/matterbridge +$STD npm ci +$STD npm run build +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed Matterbridge" + +msg_info "Creating Service" +cat </etc/systemd/system/matterbridge.service +[Unit] +Description=matterbridge +After=network-online.target + +[Service] +Type=simple +ExecStart=/usr/bin/npm run start:bridge +WorkingDirectory=/opt/matterbridge +StandardOutput=inherit +StandardError=inherit +Restart=always +RestartSec=10s +TimeoutStopSec=30s +User=root +Environment=PATH=/usr/bin:/usr/local/bin:/opt/matterbridge/bin +Environment=NODE_ENV=production + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now matterbridge.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/mediamtx-install.sh b/install/mediamtx-install.sh new file mode 100644 index 00000000..66db3047 --- /dev/null +++ b/install/mediamtx-install.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y ffmpeg +msg_ok "Installed Dependencies" + +msg_info "Installing MediaMTX" +RELEASE=$(curl -s https://api.github.com/repos/bluenviron/mediamtx/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +mkdir -p /opt/mediamtx +cd /opt/mediamtx +wget -q https://github.com/bluenviron/mediamtx/releases/download/${RELEASE}/mediamtx_${RELEASE}_linux_amd64.tar.gz +tar xzf mediamtx_${RELEASE}_linux_amd64.tar.gz +rm -rf mediamtx_${RELEASE}_linux_amd64.tar.gz +msg_ok "Installed MediaMTX" + +msg_info "Creating Service" +cat </etc/systemd/system/mediamtx.service +[Unit] +Description=MediaMTX +After=syslog.target network-online.target + +[Service] +ExecStart=/opt/mediamtx/./mediamtx +WorkingDirectory=/opt/mediamtx +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now mediamtx.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/medusa-install.sh b/install/medusa-install.sh new file mode 100644 index 00000000..34bed0af --- /dev/null +++ b/install/medusa-install.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +$STD apt-get install -y git-core +$STD apt-get install -y mediainfo +cat </etc/apt/sources.list.d/non-free.list +deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware +EOF +$STD apt-get update +$STD apt-get install -y unrar +rm /etc/apt/sources.list.d/non-free.list +msg_ok "Installed Dependencies" + +msg_info "Installing Medusa" +$STD git clone https://github.com/pymedusa/Medusa.git /opt/medusa +msg_ok "Installed Medusa" + +msg_info "Creating Service" +cat </etc/systemd/system/medusa.service +[Unit] +Description=Medusa Daemon +After=network.target + +[Service] +Type=simple +ExecStart=/usr/bin/python3 /opt/medusa/start.py -q --nolaunch --datadir=/opt/medusa +TimeoutStopSec=25 +KillMode=process +Restart=on-failure + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now medusa.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/meshcentral-install.sh b/install/meshcentral-install.sh new file mode 100644 index 00000000..c482f9a2 --- /dev/null +++ b/install/meshcentral-install.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y ca-certificates +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing MeshCentral" +mkdir /opt/meshcentral +cd /opt/meshcentral +$STD npm install meshcentral +$STD node node_modules/meshcentral --install +msg_ok "Installed MeshCentral" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/metube-install.sh b/install/metube-install.sh new file mode 100644 index 00000000..726f3f77 --- /dev/null +++ b/install/metube-install.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +# Source: https://github.com/alexta69/metube + +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 --no-install-recommends \ + build-essential \ + curl \ + aria2 \ + coreutils \ + gcc \ + g++ \ + musl-dev \ + sudo \ + ffmpeg \ + git \ + make \ + gnupg \ + ca-certificates \ + mc +msg_ok "Installed Dependencies" + +msg_info "Installing Python3" +$STD apt-get install -y \ + python3 \ + python3-dev \ + python3-pip \ + python3-venv +msg_ok "Installed Python3" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing MeTube" +$STD git clone https://github.com/alexta69/metube /opt/metube +cd /opt/metube/ui +$STD npm install +$STD node_modules/.bin/ng build +cd /opt/metube +$STD pip3 install pipenv +$STD pipenv install +mkdir -p /opt/metube_downloads /opt/metube_downloads/.metube /opt/metube_downloads/music /opt/metube_downloads/videos +cat </opt/metube/.env +DOWNLOAD_DIR=/opt/metube_downloads +STATE_DIR=/opt/metube_downloads/.metube +TEMP_DIR=/opt/metube_downloads +YTDL_OPTIONS={"trim_file_name":10} +EOF +msg_ok "Installed MeTube" + +msg_info "Creating Service" +cat </etc/systemd/system/metube.service +[Unit] +Description=Metube - YouTube Downloader +After=network.target + +[Service] +Type=simple +WorkingDirectory=/opt/metube +EnvironmentFile=/opt/metube/.env +ExecStart=/usr/local/bin/pipenv run python3 app/main.py +Restart=always +User=root + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now metube.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/mongodb-install.sh b/install/mongodb-install.sh new file mode 100644 index 00000000..6839ae51 --- /dev/null +++ b/install/mongodb-install.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 gnupg +$STD apt-get install -y curl +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing MongoDB" +wget -qO- https://www.mongodb.org/static/pgp/server-7.0.asc | gpg --dearmor >/usr/share/keyrings/mongodb-server-7.0.gpg +echo "deb [signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg] http://repo.mongodb.org/apt/debian $(grep '^VERSION_CODENAME=' /etc/os-release | cut -d'=' -f2)/mongodb-org/7.0 main" >/etc/apt/sources.list.d/mongodb-org-7.0.list +$STD apt-get update +$STD apt-get install -y mongodb-org +sed -i 's/bindIp: 127.0.0.1/bindIp: 0.0.0.0/' /etc/mongod.conf +systemctl enable -q --now mongod.service +msg_ok "Installed MongoDB" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/motioneye-install.sh b/install/motioneye-install.sh new file mode 100644 index 00000000..99e24413 --- /dev/null +++ b/install/motioneye-install.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y cifs-utils +msg_ok "Installed Dependencies" + +msg_info "Updating Python3" +$STD apt-get install -y \ + python3 \ + python3-dev \ + python3-pip +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Updated Python3" + +msg_info "Installing Motion" +$STD apt-get install -y motion +systemctl stop motion +$STD systemctl disable motion +msg_ok "Installed Motion" + +msg_info "Installing FFmpeg" +$STD apt-get install -y ffmpeg v4l-utils +msg_ok "Installed FFmpeg" + +msg_info "Installing MotionEye" +$STD apt-get update +$STD pip install git+https://github.com/motioneye-project/motioneye.git@dev +mkdir -p /etc/motioneye +chown -R root:root /etc/motioneye +chmod -R 777 /etc/motioneye +wget -qO /etc/motioneye/motioneye.conf https://raw.githubusercontent.com/motioneye-project/motioneye/dev/motioneye/extra/motioneye.conf.sample +mkdir -p /var/lib/motioneye +msg_ok "Installed MotionEye" + +msg_info "Creating Service" +wget -qO /etc/systemd/system/motioneye.service https://raw.githubusercontent.com/motioneye-project/motioneye/dev/motioneye/extra/motioneye.systemd +systemctl enable -q --now motioneye +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/mqtt-install.sh b/install/mqtt-install.sh new file mode 100644 index 00000000..61a01fbe --- /dev/null +++ b/install/mqtt-install.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +msg_ok "Installed Dependencies" + +msg_info "Installing Mosquitto MQTT Broker" +$STD apt-get -y install mosquitto +$STD apt-get -y install mosquitto-clients +cat </etc/mosquitto/conf.d/default.conf +allow_anonymous false +persistence true +password_file /etc/mosquitto/passwd +listener 1883 +EOF +msg_ok "Installed Mosquitto MQTT Broker" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/myspeed-install.sh b/install/myspeed-install.sh new file mode 100644 index 00000000..45ef62a6 --- /dev/null +++ b/install/myspeed-install.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +# Source: https://github.com/gnmyt/myspeed + +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 \ + sudo \ + make \ + gpg \ + ca-certificates \ + mc +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing MySpeed" +RELEASE=$(wget -q https://github.com/gnmyt/myspeed/releases/latest -O - | grep "title>Release" | cut -d " " -f 5) +cd /opt +wget -q https://github.com/gnmyt/myspeed/releases/download/v$RELEASE/MySpeed-$RELEASE.zip +unzip -q MySpeed-$RELEASE.zip -d myspeed +cd myspeed +$STD npm install +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed MySpeed" + +msg_info "Creating Service" +cat </etc/systemd/system/myspeed.service +[Unit] +Description=MySpeed +After=network.target + +[Service] +Type=simple +ExecStart=/usr/bin/node server +Restart=always +User=root +Environment=NODE_ENV=production +WorkingDirectory=/opt/myspeed + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now myspeed.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +rm -rf /opt/MySpeed-$RELEASE.zip +$STD apt-get -y autoclean +msg_ok "Cleaned" \ No newline at end of file diff --git a/install/n8n-install.sh b/install/n8n-install.sh new file mode 100644 index 00000000..811c166d --- /dev/null +++ b/install/n8n-install.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y ca-certificates +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing n8n (Patience)" +$STD npm install --global patch-package +$STD npm install --global n8n +msg_ok "Installed n8n" + +msg_info "Creating Service" +cat </etc/systemd/system/n8n.service +[Unit] +Description=n8n + +[Service] +Type=simple +Environment="N8N_SECURE_COOKIE=false" +ExecStart=n8n start +[Install] +WantedBy=multi-user.target +EOF +$STD systemctl enable --now n8n +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/navidrome-install.sh b/install/navidrome-install.sh new file mode 100644 index 00000000..42235dc8 --- /dev/null +++ b/install/navidrome-install.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (patience)" +$STD apt-get install -y curl +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y ffmpeg +msg_ok "Installed Dependencies" + +RELEASE=$(curl -s https://api.github.com/repos/navidrome/navidrome/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + +msg_info "Installing Navidrome" +install -d -o root -g root /opt/navidrome +install -d -o root -g root /var/lib/navidrome +wget -q https://github.com/navidrome/navidrome/releases/download/v${RELEASE}/navidrome_${RELEASE}_linux_amd64.tar.gz -O Navidrome.tar.gz +$STD tar -xvzf Navidrome.tar.gz -C /opt/navidrome/ +chown -R root:root /opt/navidrome +mkdir -p /music +cat </var/lib/navidrome/navidrome.toml +MusicFolder = '/music' +EOF +msg_ok "Installed Navidrome" + +msg_info "Creating Service" +service_path="/etc/systemd/system/navidrome.service" + +echo "[Unit] +Description=Navidrome Music Server and Streamer compatible with Subsonic/Airsonic +After=remote-fs.target network.target +AssertPathExists=/var/lib/navidrome + +[Service] +User=root +Group=root +Type=simple +ExecStart=/opt/navidrome/navidrome --configfile '/var/lib/navidrome/navidrome.toml' +WorkingDirectory=/var/lib/navidrome +TimeoutStopSec=20 +KillMode=process +Restart=on-failure +DevicePolicy=closed +NoNewPrivileges=yes +PrivateTmp=yes +PrivateUsers=yes +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictNamespaces=yes +RestrictRealtime=yes +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap +ReadWritePaths=/var/lib/navidrome +ProtectSystem=full + +[Install] +WantedBy=multi-user.target" >$service_path +systemctl daemon-reload +$STD systemctl enable --now navidrome.service + +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +rm -rf /root/Navidrome.tar.gz +msg_ok "Cleaned" diff --git a/install/nextcloudpi-install.sh b/install/nextcloudpi-install.sh new file mode 100644 index 00000000..ca1871dd --- /dev/null +++ b/install/nextcloudpi-install.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing NextCloudPi (Patience)" +$STD apt-get install -y systemd-resolved +systemctl enable -q --now systemd-resolved +cat <<'EOF' >/etc/systemd/resolved.conf +[Resolve] +DNS=8.8.8.8 +FallbackDNS=8.8.4.4 +EOF +systemctl restart systemd-resolved +$STD bash <(curl -fsSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install.sh) +systemctl disable -q --now systemd-resolved +$STD apt-get remove -y systemd-resolved +msg_ok "Installed NextCloudPi" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/nginxproxymanager-install.sh b/install/nginxproxymanager-install.sh new file mode 100644 index 00000000..4314e293 --- /dev/null +++ b/install/nginxproxymanager-install.sh @@ -0,0 +1,208 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 update +$STD apt-get -y install \ + sudo \ + mc \ + curl \ + gnupg \ + make \ + gcc \ + g++ \ + ca-certificates \ + apache2-utils \ + logrotate \ + build-essential \ + git +msg_ok "Installed Dependencies" + +msg_info "Installing Python Dependencies" +$STD apt-get install -y \ + python3 \ + python3-dev \ + python3-pip \ + python3-venv \ + python3-cffi \ + python3-certbot \ + python3-certbot-dns-cloudflare +$STD pip3 install certbot-dns-multi +$STD python3 -m venv /opt/certbot/ +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Installed Python Dependencies" + +VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)" + +msg_info "Installing Openresty" +wget -qO - https://openresty.org/package/pubkey.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/openresty-archive-keyring.gpg +echo -e "deb http://openresty.org/package/debian bullseye openresty" >/etc/apt/sources.list.d/openresty.list +$STD apt-get update +$STD apt-get -y install openresty +msg_ok "Installed Openresty" + +msg_info "Installing Node.js" +$STD bash <(curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh) +source ~/.bashrc +$STD nvm install 16.20.2 +ln -sf /root/.nvm/versions/node/v16.20.2/bin/node /usr/bin/node +msg_ok "Installed Node.js" + +msg_info "Installing pnpm" +$STD npm install -g pnpm@8.15 +msg_ok "Installed pnpm" + +RELEASE=$(curl -s https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest | + grep "tag_name" | + awk '{print substr($2, 3, length($2)-4) }') + +read -r -p "Would you like to install an older version (v2.10.4)? " prompt +if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + msg_info "Downloading Nginx Proxy Manager v2.10.4" + wget -q https://codeload.github.com/NginxProxyManager/nginx-proxy-manager/tar.gz/v2.10.4 -O - | tar -xz + cd ./nginx-proxy-manager-2.10.4 + msg_ok "Downloaded Nginx Proxy Manager v2.10.4" +else + msg_info "Downloading Nginx Proxy Manager v${RELEASE}" + wget -q https://codeload.github.com/NginxProxyManager/nginx-proxy-manager/tar.gz/v${RELEASE} -O - | tar -xz + cd ./nginx-proxy-manager-${RELEASE} + msg_ok "Downloaded Nginx Proxy Manager v${RELEASE}" +fi +msg_info "Setting up Enviroment" +ln -sf /usr/bin/python3 /usr/bin/python +ln -sf /usr/bin/certbot /opt/certbot/bin/certbot +ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx +ln -sf /usr/local/openresty/nginx/ /etc/nginx +if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + sed -i "s|\"version\": \"0.0.0\"|\"version\": \"2.10.4\"|" backend/package.json + sed -i "s|\"version\": \"0.0.0\"|\"version\": \"2.10.4\"|" frontend/package.json +else + sed -i "s|\"version\": \"0.0.0\"|\"version\": \"$RELEASE\"|" backend/package.json + sed -i "s|\"version\": \"0.0.0\"|\"version\": \"$RELEASE\"|" frontend/package.json +fi +sed -i 's|"fork-me": ".*"|"fork-me": "Proxmox VE Helper-Scripts"|' frontend/js/i18n/messages.json +sed -i "s|https://github.com.*source=nginx-proxy-manager|https://helper-scripts.com|g" frontend/js/app/ui/footer/main.ejs +sed -i 's+^daemon+#daemon+g' docker/rootfs/etc/nginx/nginx.conf +NGINX_CONFS=$(find "$(pwd)" -type f -name "*.conf") +for NGINX_CONF in $NGINX_CONFS; do + sed -i 's+include conf.d+include /etc/nginx/conf.d+g' "$NGINX_CONF" +done + +mkdir -p /var/www/html /etc/nginx/logs +cp -r docker/rootfs/var/www/html/* /var/www/html/ +cp -r docker/rootfs/etc/nginx/* /etc/nginx/ +cp docker/rootfs/etc/letsencrypt.ini /etc/letsencrypt.ini +cp docker/rootfs/etc/logrotate.d/nginx-proxy-manager /etc/logrotate.d/nginx-proxy-manager +ln -sf /etc/nginx/nginx.conf /etc/nginx/conf/nginx.conf +rm -f /etc/nginx/conf.d/dev.conf + +mkdir -p /tmp/nginx/body \ + /run/nginx \ + /data/nginx \ + /data/custom_ssl \ + /data/logs \ + /data/access \ + /data/nginx/default_host \ + /data/nginx/default_www \ + /data/nginx/proxy_host \ + /data/nginx/redirection_host \ + /data/nginx/stream \ + /data/nginx/dead_host \ + /data/nginx/temp \ + /var/lib/nginx/cache/public \ + /var/lib/nginx/cache/private \ + /var/cache/nginx/proxy_temp + +chmod -R 777 /var/cache/nginx +chown root /tmp/nginx + +echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf);" >/etc/nginx/conf.d/include/resolvers.conf + +if [ ! -f /data/nginx/dummycert.pem ] || [ ! -f /data/nginx/dummykey.pem ]; then + openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -subj "/O=Nginx Proxy Manager/OU=Dummy Certificate/CN=localhost" -keyout /data/nginx/dummykey.pem -out /data/nginx/dummycert.pem &>/dev/null +fi + +mkdir -p /app/global /app/frontend/images +cp -r backend/* /app +cp -r global/* /app/global +msg_ok "Set up Enviroment" + +msg_info "Building Frontend" +cd ./frontend +$STD pnpm install +$STD pnpm upgrade +$STD pnpm run build +cp -r dist/* /app/frontend +cp -r app-images/* /app/frontend/images +msg_ok "Built Frontend" + +msg_info "Initializing Backend" +rm -rf /app/config/default.json +if [ ! -f /app/config/production.json ]; then + cat <<'EOF' >/app/config/production.json +{ + "database": { + "engine": "knex-native", + "knex": { + "client": "sqlite3", + "connection": { + "filename": "/data/database.sqlite" + } + } + } +} +EOF +fi +cd /app +$STD pnpm install +msg_ok "Initialized Backend" + +msg_info "Creating Service" +cat <<'EOF' >/lib/systemd/system/npm.service +[Unit] +Description=Nginx Proxy Manager +After=network.target +Wants=openresty.service + +[Service] +Type=simple +Environment=NODE_ENV=production +ExecStartPre=-mkdir -p /tmp/nginx/body /data/letsencrypt-acme-challenge +ExecStart=/usr/bin/node index.js --abort_on_uncaught_exception --max_old_space_size=250 +WorkingDirectory=/app +Restart=on-failure + +[Install] +WantedBy=multi-user.target +EOF +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Starting Services" +sed -i 's/user npm/user root/g; s/^pid/#pid/g' /usr/local/openresty/nginx/conf/nginx.conf +sed -r -i 's/^([[:space:]]*)su npm npm/\1#su npm npm/g;' /etc/logrotate.d/nginx-proxy-manager +sed -i 's/include-system-site-packages = false/include-system-site-packages = true/g' /opt/certbot/pyvenv.cfg +systemctl enable -q --now openresty +systemctl enable -q --now npm +msg_ok "Started Services" + +msg_info "Cleaning up" +rm -rf ../nginx-proxy-manager-* +systemctl restart openresty +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/nocodb-install.sh b/install/nocodb-install.sh new file mode 100644 index 00000000..612d7983 --- /dev/null +++ b/install/nocodb-install.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing NocoDB" +mkdir -p /opt/nocodb +cd /opt/nocodb +curl -s http://get.nocodb.com/linux-x64 -o nocodb -L +chmod +x nocodb +msg_ok "Installed NocoDB" + +msg_info "Creating Service" +service_path="/etc/systemd/system/nocodb.service" +echo "[Unit] +Description=nocodb + +[Service] +Type=simple +Restart=always +User=root +WorkingDirectory=/opt/nocodb +ExecStart=/opt/nocodb/./nocodb + +[Install] +WantedBy=multi-user.target" >$service_path +systemctl enable -q --now nocodb.service &>/dev/null +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/node-red-install.sh b/install/node-red-install.sh new file mode 100644 index 00000000..8ca280be --- /dev/null +++ b/install/node-red-install.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y ca-certificates +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing Node-Red" +$STD npm install -g --unsafe-perm node-red +echo "journalctl -f -n 100 -u nodered -o cat" >/usr/bin/node-red-log +chmod +x /usr/bin/node-red-log +echo "systemctl stop nodered" >/usr/bin/node-red-stop +chmod +x /usr/bin/node-red-stop +echo "systemctl start nodered" >/usr/bin/node-red-start +chmod +x /usr/bin/node-red-start +echo "systemctl restart nodered" >/usr/bin/node-red-restart +chmod +x /usr/bin/node-red-restart +msg_ok "Installed Node-Red" + +msg_info "Creating Service" +service_path="/etc/systemd/system/nodered.service" +echo "[Unit] +Description=Node-RED +After=syslog.target network.target + +[Service] +ExecStart=/usr/bin/node-red --max-old-space-size=128 -v +Restart=on-failure +KillSignal=SIGINT + +SyslogIdentifier=node-red +StandardOutput=syslog + +WorkingDirectory=/root/ +User=root +Group=root + +[Install] +WantedBy=multi-user.target" >$service_path +$STD systemctl enable --now nodered.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/notifiarr-install.sh b/install/notifiarr-install.sh new file mode 100644 index 00000000..a90217c0 --- /dev/null +++ b/install/notifiarr-install.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +msg_ok "Installed Dependencies" + +msg_info "Installing Notifiarr" +$STD groupadd notifiarr +$STD useradd -g notifiarr notifiarr +wget -qO- https://packagecloud.io/golift/pkgs/gpgkey | gpg --dearmor >/usr/share/keyrings/golift-archive-keyring.gpg +echo "deb [signed-by=/usr/share/keyrings/golift-archive-keyring.gpg] https://packagecloud.io/golift/pkgs/ubuntu focal main" >/etc/apt/sources.list.d/golift.list +$STD apt-get update +$STD apt-get install -y notifiarr +msg_ok "Installed Notifiarr" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/ntfy-install.sh b/install/ntfy-install.sh new file mode 100644 index 00000000..578e8966 --- /dev/null +++ b/install/ntfy-install.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +$STD apt-get install -y apt-transport-https +msg_ok "Installed Dependencies" + +msg_info "Installing ntfy" +mkdir -p /etc/apt/keyrings +curl -fsSL https://archive.heckel.io/apt/pubkey.txt | gpg --dearmor -o /etc/apt/keyrings/archive.heckel.io.gpg +echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/archive.heckel.io.gpg] https://archive.heckel.io/apt debian main" >/etc/apt/sources.list.d/archive.heckel.io.list +$STD apt-get update +$STD apt-get install -y ntfy +systemctl enable -q --now ntfy +msg_ok "Installed ntfy" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/octoprint-install.sh b/install/octoprint-install.sh new file mode 100644 index 00000000..ac9eacfb --- /dev/null +++ b/install/octoprint-install.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y libyaml-dev +$STD apt-get install -y build-essential +msg_ok "Installed Dependencies" + +msg_info "Updating Python3" +$STD apt-get install -y \ + python3 \ + python3-dev \ + python3-pip \ + python3-venv + +$STD apt-get install -y python3-setuptools +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Updated Python3" + +msg_info "Creating user octoprint" +useradd -m -s /bin/bash -p $(openssl passwd -1 octoprint) octoprint +usermod -aG sudo,tty,dialout octoprint +chown -R octoprint:octoprint /opt +msg_ok "Created user octoprint" + +msg_info "Installing OctoPrint" +$STD sudo -u octoprint bash << EOF +mkdir /opt/octoprint +cd /opt/octoprint +python3 -m venv . +source bin/activate +pip install --upgrade pip +pip install wheel +pip install octoprint +EOF +msg_ok "Installed OctoPrint" + +msg_info "Creating Service" +cat </etc/systemd/system/octoprint.service +[Unit] +Description=The snappy web interface for your 3D printer +After=network-online.target +Wants=network-online.target + +[Service] +Environment="LC_ALL=C.UTF-8" +Environment="LANG=C.UTF-8" +Type=exec +User=octoprint +ExecStart=/opt/octoprint/bin/octoprint serve + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now octoprint.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/omada-install.sh b/install/omada-install.sh new file mode 100644 index 00000000..8bd0f1f9 --- /dev/null +++ b/install/omada-install.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gnupg +$STD apt-get install -y jsvc +msg_ok "Installed Dependencies" + +msg_info "Installing Azul Zulu" +wget -qO /etc/apt/trusted.gpg.d/zulu-repo.asc "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xB1998361219BD9C9" +wget -q https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-3_all.deb +$STD dpkg -i zulu-repo_1.0.0-3_all.deb +$STD apt-get update +$STD apt-get -y install zulu8-jdk +msg_ok "Installed Azul Zulu" + +msg_info "Installing MongoDB" +libssl=$(curl -fsSL "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/" | grep -o 'libssl1\.1_1\.1\.1f-1ubuntu2\.2[^"]*amd64\.deb' | head -n1) +wget -qL http://security.ubuntu.com/ubuntu/pool/main/o/openssl/$libssl +$STD dpkg -i $libssl +wget -qL https://repo.mongodb.org/apt/ubuntu/dists/bionic/mongodb-org/3.6/multiverse/binary-amd64/mongodb-org-server_3.6.23_amd64.deb +$STD dpkg -i mongodb-org-server_3.6.23_amd64.deb +msg_ok "Installed MongoDB" + +latest_url=$(curl -fsSL "https://www.tp-link.com/en/support/download/omada-software-controller/" | grep -o 'https://.*x64.deb' | head -n1) +latest_version=$(basename "$latest_url") + +msg_info "Installing Omada Controller" +wget -qL ${latest_url} +$STD dpkg -i ${latest_version} +msg_ok "Installed Omada Controller" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf ${latest_version} mongodb-org-server_3.6.23_amd64.deb zulu-repo_1.0.0-3_all.deb $libssl +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/ombi-install.sh b/install/ombi-install.sh new file mode 100644 index 00000000..f42e528b --- /dev/null +++ b/install/ombi-install.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Ombi" +RELEASE=$(curl -sL https://api.github.com/repos/Ombi-app/Ombi/releases/latest | grep '"tag_name":' | cut -d'"' -f4) +wget -q https://github.com/Ombi-app/Ombi/releases/download/${RELEASE}/linux-x64.tar.gz +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +mkdir -p /opt/ombi +tar -xzf linux-x64.tar.gz -C /opt/ombi +rm -rf linux-x64.tar.gz +msg_ok "Installed Ombi" + +msg_info "Creating Service" +cat </etc/systemd/system/ombi.service +[Unit] +Description=Ombi +After=syslog.target network-online.target + +[Service] +ExecStart=/opt/ombi/./Ombi +WorkingDirectory=/opt/ombi +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now ombi.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/omv-install.sh b/install/omv-install.sh new file mode 100644 index 00000000..2fb700ae --- /dev/null +++ b/install/omv-install.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +msg_ok "Installed Dependencies" + +msg_info "Installing OpenMediaVault (Patience)" +wget -qO- https://packages.openmediavault.org/public/archive.key | gpg --dearmor >"/etc/apt/trusted.gpg.d/openmediavault-archive-keyring.gpg" + +cat </etc/apt/sources.list.d/openmediavault.list +deb [signed-by=/etc/apt/trusted.gpg.d/openmediavault-archive-keyring.gpg] http://packages.openmediavault.org/public sandworm main +EOF + +export LANG=C.UTF-8 +export DEBIAN_FRONTEND=noninteractive +export APT_LISTCHANGES_FRONTEND=none +$STD apt-get update +apt-get -y --auto-remove --show-upgraded --allow-downgrades --allow-change-held-packages --no-install-recommends --option DPkg::Options::="--force-confdef" --option DPkg::Options::="--force-confold" install openmediavault-keyring openmediavault &>/dev/null +omv-confdbadm populate &>/dev/null +msg_ok "Installed OpenMediaVault" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/openhab-install.sh b/install/openhab-install.sh new file mode 100644 index 00000000..40661c6c --- /dev/null +++ b/install/openhab-install.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gnupg +$STD apt-get install -y apt-transport-https +msg_ok "Installed Dependencies" + +msg_info "Installing Azul Zulu" +wget -qO /etc/apt/trusted.gpg.d/zulu-repo.asc "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xB1998361219BD9C9" +wget -q https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-3_all.deb +$STD dpkg -i zulu-repo_1.0.0-3_all.deb +$STD apt-get update +$STD apt-get -y install zulu17-jdk +msg_ok "Installed Azul Zulu" + +msg_info "Installing openHAB" +curl -fsSL "https://openhab.jfrog.io/artifactory/api/gpg/key/public" | gpg --dearmor >openhab.gpg +mv openhab.gpg /usr/share/keyrings +chmod u=rw,g=r,o=r /usr/share/keyrings/openhab.gpg +echo "deb [signed-by=/usr/share/keyrings/openhab.gpg] https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable main" > /etc/apt/sources.list.d/openhab.list +$STD apt update +$STD apt-get -y install openhab +systemctl daemon-reload +systemctl enable -q --now openhab.service +msg_ok "Installed openHAB" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/openobserve-install.sh b/install/openobserve-install.sh new file mode 100644 index 00000000..7fff763e --- /dev/null +++ b/install/openobserve-install.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing OpenObserve" +mkdir -p /opt/openobserve/data +LATEST=$(curl -sL https://api.github.com/repos/openobserve/openobserve/releases/latest | grep '"tag_name":' | cut -d'"' -f4) +$STD tar zxvf <(curl -fsSL https://github.com/openobserve/openobserve/releases/download/$LATEST/openobserve-${LATEST}-linux-amd64.tar.gz) -C /opt/openobserve + +cat </opt/openobserve/data/.env +ZO_ROOT_USER_EMAIL = "admin@example.com" +ZO_ROOT_USER_PASSWORD = "$(openssl rand -base64 18 | cut -c1-13)" +ZO_DATA_DIR = "/opt/openobserve/data" +ZO_HTTP_PORT = "5080" +EOF +msg_ok "Installed OpenObserve" + +msg_info "Creating Service" +cat </etc/systemd/system/openobserve.service +[Unit] +Description=OpenObserve +After=network.target + +[Service] +Type=simple +EnvironmentFile=/opt/openobserve/data/.env +ExecStart=/opt/openobserve/openobserve +ExecStop=killall -QUIT openobserve +Restart=on-failure + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now openobserve +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/overseerr-install.sh b/install/overseerr-install.sh new file mode 100644 index 00000000..dd65cd67 --- /dev/null +++ b/install/overseerr-install.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y ca-certificates +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing Yarn" +$STD npm install -g yarn +msg_ok "Installed Yarn" + +msg_info "Installing Overseerr (Patience)" +git clone -q https://github.com/sct/overseerr.git /opt/overseerr +cd /opt/overseerr +$STD yarn install +$STD yarn build +msg_ok "Installed Overseerr" + +msg_info "Creating Service" +cat </etc/systemd/system/overseerr.service +[Unit] +Description=Overseerr Service +After=network.target + +[Service] +Type=exec +WorkingDirectory=/opt/overseerr +ExecStart=/usr/bin/yarn start + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now overseerr.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/owncast-install.sh b/install/owncast-install.sh new file mode 100644 index 00000000..ca6f30c3 --- /dev/null +++ b/install/owncast-install.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get install -y curl +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y ffmpeg +msg_ok "Installed Dependencies" + +msg_info "Installing Owncast" +mkdir /opt/owncast +cd /opt/owncast +wget -q $(curl -s https://api.github.com/repos/owncast/owncast/releases/latest | grep download | grep linux-64bit | cut -d\" -f4) +$STD unzip owncast*.zip +rm owncast*.zip +msg_ok "Installed Owncast" + +msg_info "Creating Service" +cat </etc/systemd/system/owncast.service +[Unit] +Description=Owncast +After=syslog.target network-online.target + +[Service] +ExecStart=/opt/owncast/./owncast +WorkingDirectory=/opt/owncast +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now owncast.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/pairdrop-install.sh b/install/pairdrop-install.sh new file mode 100644 index 00000000..75070cd7 --- /dev/null +++ b/install/pairdrop-install.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y gpg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing PairDrop" +git clone -q https://github.com/schlagmichdoch/PairDrop.git /opt/pairdrop +cd /opt/pairdrop +$STD npm install +msg_ok "Installed PairDrop" + +msg_info "Creating Service" +cat </etc/systemd/system/pairdrop.service +[Unit] +Description=PairDrop Service +After=network.target + +[Service] +ExecStart=npm start +WorkingDirectory=/opt/pairdrop +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now pairdrop.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/paperless-ngx-install.sh b/install/paperless-ngx-install.sh new file mode 100644 index 00000000..7edabf2b --- /dev/null +++ b/install/paperless-ngx-install.sh @@ -0,0 +1,226 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get install -y --no-install-recommends \ + redis \ + postgresql \ + build-essential \ + imagemagick \ + fonts-liberation \ + optipng \ + gnupg \ + libpq-dev \ + libmagic-dev \ + mime-support \ + libzbar0 \ + poppler-utils \ + default-libmysqlclient-dev \ + automake \ + libtool \ + pkg-config \ + git \ + curl \ + libtiff-dev \ + libpng-dev \ + libleptonica-dev \ + sudo \ + mc +msg_ok "Installed Dependencies" + +msg_info "Installing Python3 Dependencies" +$STD apt-get install -y --no-install-recommends \ + python3 \ + python3-pip \ + python3-dev \ + python3-setuptools \ + python3-wheel +msg_ok "Installed Python3 Dependencies" + +msg_info "Installing OCR Dependencies (Patience)" +$STD apt-get install -y --no-install-recommends \ + unpaper \ + ghostscript \ + icc-profiles-free \ + qpdf \ + liblept5 \ + libxml2 \ + pngquant \ + zlib1g \ + tesseract-ocr \ + tesseract-ocr-eng +msg_ok "Installed OCR Dependencies" + +msg_info "Installing JBIG2" +$STD git clone https://github.com/agl/jbig2enc /opt/jbig2enc +cd /opt/jbig2enc +$STD bash ./autogen.sh +$STD bash ./configure +$STD make +$STD make install +rm -rf /opt/jbig2enc +msg_ok "Installed JBIG2" + +msg_info "Installing Paperless-ngx (Patience)" +Paperlessngx=$(wget -q https://github.com/paperless-ngx/paperless-ngx/releases/latest -O - | grep "title>Release" | cut -d " " -f 5) +cd /opt +$STD wget https://github.com/paperless-ngx/paperless-ngx/releases/download/$Paperlessngx/paperless-ngx-$Paperlessngx.tar.xz +$STD tar -xf paperless-ngx-$Paperlessngx.tar.xz -C /opt/ +mv paperless-ngx paperless +rm paperless-ngx-$Paperlessngx.tar.xz +cd /opt/paperless +$STD pip install --upgrade pip +$STD pip install -r requirements.txt +curl -s -o /opt/paperless/paperless.conf https://raw.githubusercontent.com/paperless-ngx/paperless-ngx/main/paperless.conf.example +mkdir -p {consume,data,media,static} +sed -i -e 's|#PAPERLESS_REDIS=redis://localhost:6379|PAPERLESS_REDIS=redis://localhost:6379|' /opt/paperless/paperless.conf +sed -i -e "s|#PAPERLESS_CONSUMPTION_DIR=../consume|PAPERLESS_CONSUMPTION_DIR=/opt/paperless/consume|" /opt/paperless/paperless.conf +sed -i -e "s|#PAPERLESS_DATA_DIR=../data|PAPERLESS_DATA_DIR=/opt/paperless/data|" /opt/paperless/paperless.conf +sed -i -e "s|#PAPERLESS_MEDIA_ROOT=../media|PAPERLESS_MEDIA_ROOT=/opt/paperless/media|" /opt/paperless/paperless.conf +sed -i -e "s|#PAPERLESS_STATICDIR=../static|PAPERLESS_STATICDIR=/opt/paperless/static|" /opt/paperless/paperless.conf +echo "${Paperlessngx}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed Paperless-ngx" + +msg_info "Installing Natural Language Toolkit (Patience)" +$STD python3 -m nltk.downloader -d /usr/share/nltk_data all +msg_ok "Installed Natural Language Toolkit" + +msg_info "Setting up PostgreSQL database" +DB_NAME=paperlessdb +DB_USER=paperless +DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" +SECRET_KEY="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)" +$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" +$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" +echo "" >>~/paperless.creds +echo -e "Paperless-ngx Database User: \e[32m$DB_USER\e[0m" >>~/paperless.creds +echo -e "Paperless-ngx Database Password: \e[32m$DB_PASS\e[0m" >>~/paperless.creds +echo -e "Paperless-ngx Database Name: \e[32m$DB_NAME\e[0m" >>~/paperless.creds +sed -i -e 's|#PAPERLESS_DBHOST=localhost|PAPERLESS_DBHOST=localhost|' /opt/paperless/paperless.conf +sed -i -e 's|#PAPERLESS_DBPORT=5432|PAPERLESS_DBPORT=5432|' /opt/paperless/paperless.conf +sed -i -e "s|#PAPERLESS_DBNAME=paperless|PAPERLESS_DBNAME=$DB_NAME|" /opt/paperless/paperless.conf +sed -i -e "s|#PAPERLESS_DBUSER=paperless|PAPERLESS_DBUSER=$DB_USER|" /opt/paperless/paperless.conf +sed -i -e "s|#PAPERLESS_DBPASS=paperless|PAPERLESS_DBPASS=$DB_PASS|" /opt/paperless/paperless.conf +sed -i -e "s|#PAPERLESS_SECRET_KEY=change-me|PAPERLESS_SECRET_KEY=$SECRET_KEY|" /opt/paperless/paperless.conf +cd /opt/paperless/src +$STD python3 manage.py migrate +msg_ok "Set up PostgreSQL database" + +read -r -p "Would you like to add Adminer? " prompt +if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + msg_info "Installing Adminer" + $STD apt install -y adminer + $STD a2enconf adminer + systemctl reload apache2 + IP=$(hostname -I | awk '{print $1}') + echo "" >>~/paperless.creds + echo -e "Adminer Interface: \e[32m$IP/adminer/\e[0m" >>~/paperless.creds + echo -e "Adminer System: \e[32mPostgreSQL\e[0m" >>~/paperless.creds + echo -e "Adminer Server: \e[32mlocalhost:5432\e[0m" >>~/paperless.creds + echo -e "Adminer Username: \e[32m$DB_USER\e[0m" >>~/paperless.creds + echo -e "Adminer Password: \e[32m$DB_PASS\e[0m" >>~/paperless.creds + echo -e "Adminer Database: \e[32m$DB_NAME\e[0m" >>~/paperless.creds + msg_ok "Installed Adminer" +fi + +msg_info "Setting up admin Paperless-ngx User & Password" +## From https://github.com/linuxserver/docker-paperless-ngx/blob/main/root/etc/cont-init.d/99-migrations +cat <>~/paperless.creds +echo -e "Paperless-ngx WebUI User: \e[32madmin\e[0m" >>~/paperless.creds +echo -e "Paperless-ngx WebUI Password: \e[32m$DB_PASS\e[0m" >>~/paperless.creds +echo "" >>~/paperless.creds +msg_ok "Set up admin Paperless-ngx User & Password" + +msg_info "Creating Services" +cat </etc/systemd/system/paperless-scheduler.service +[Unit] +Description=Paperless Celery beat +Requires=redis.service + +[Service] +WorkingDirectory=/opt/paperless/src +ExecStart=celery --app paperless beat --loglevel INFO + +[Install] +WantedBy=multi-user.target +EOF + +cat </etc/systemd/system/paperless-task-queue.service +[Unit] +Description=Paperless Celery Workers +Requires=redis.service +After=postgresql.service + +[Service] +WorkingDirectory=/opt/paperless/src +ExecStart=celery --app paperless worker --loglevel INFO + +[Install] +WantedBy=multi-user.target +EOF + +cat </etc/systemd/system/paperless-consumer.service +[Unit] +Description=Paperless consumer +Requires=redis.service + +[Service] +WorkingDirectory=/opt/paperless/src +ExecStart=python3 manage.py document_consumer + +[Install] +WantedBy=multi-user.target +EOF + +cat </etc/systemd/system/paperless-webserver.service +[Unit] +Description=Paperless webserver +After=network.target +Wants=network.target +Requires=redis.service + +[Service] +WorkingDirectory=/opt/paperless/src +ExecStart=/usr/local/bin/gunicorn -c /opt/paperless/gunicorn.conf.py paperless.asgi:application + +[Install] +WantedBy=multi-user.target +EOF + +sed -i -e 's/rights="none" pattern="PDF"/rights="read|write" pattern="PDF"/' /etc/ImageMagick-6/policy.xml + +systemctl daemon-reload +$STD systemctl enable --now paperless-consumer paperless-webserver paperless-scheduler paperless-task-queue.service +msg_ok "Created Services" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf /opt/paperless/docker +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/pbs-install.sh b/install/pbs-install.sh new file mode 100644 index 00000000..5f5dc017 --- /dev/null +++ b/install/pbs-install.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Proxmox Backup Server" +wget -q https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg +cat <>/etc/apt/sources.list +deb http://download.proxmox.com/debian/pbs bookworm pbs-no-subscription +EOF +$STD apt-get update +$STD apt-get install -y proxmox-backup-server +msg_ok "Installed Proxmox Backup Server" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/peanut-install.sh b/install/peanut-install.sh new file mode 100644 index 00000000..f32e764f --- /dev/null +++ b/install/peanut-install.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: remz1337 +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +msg_ok "Installed Dependencies" + +msg_info "Installing Node.js" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing NUT" +$STD apt-get install -y nut-client +msg_ok "Installed NUT" + +msg_info "Installing Peanut" +RELEASE=$(curl -sL https://api.github.com/repos/Brandawg93/PeaNUT/releases/latest | grep '"tag_name":' | cut -d'"' -f4) +wget -qO peanut.tar.gz https://api.github.com/repos/Brandawg93/PeaNUT/tarball/${RELEASE} +mkdir -p /opt/peanut +tar -xzf peanut.tar.gz -C /opt/peanut --strip-components 1 +rm peanut.tar.gz +cd /opt/peanut +$STD npm install -g pnpm +$STD pnpm i +$STD pnpm run build +cp -r .next/static .next/standalone/.next/ +msg_ok "Installed Peanut" + +msg_info "Creating Service" +cat </etc/systemd/system/peanut.service +[Unit] +Description=Peanut +After=network.target +[Service] +SyslogIdentifier=peanut +Restart=always +RestartSec=5 +Type=simple +Environment="NODE_ENV=production" +Environment="NUT_HOST=localhost" +Environment="NUT_PORT=3493" +Environment="WEB_HOST=0.0.0.0" +Environment="WEB_PORT=3000" +WorkingDirectory=/opt/peanut +ExecStart=node /opt/peanut/.next/standalone/server.js +TimeoutStopSec=30 +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now peanut.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" \ No newline at end of file diff --git a/install/petio-install.sh b/install/petio-install.sh new file mode 100644 index 00000000..0de03f15 --- /dev/null +++ b/install/petio-install.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 gnupg +$STD apt-get install -y curl +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing MongoDB 4.4" +wget -qO- https://www.mongodb.org/static/pgp/server-4.4.asc | gpg --dearmor >/usr/share/keyrings/mongodb-server-4.4.gpg +# Determine OS ID +OS_ID=$(grep '^ID=' /etc/os-release | cut -d'=' -f2) + +if [ "$OS_ID" = "debian" ]; then +echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-4.4.gpg ] http://repo.mongodb.org/apt/debian $(grep '^VERSION_CODENAME=' /etc/os-release | cut -d'=' -f2)/mongodb-org/4.4 main" > /etc/apt/sources.list.d/mongodb-org-4.4.list +else +echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-4.4.gpg ] https://repo.mongodb.org/apt/ubuntu $(grep '^VERSION_CODENAME=' /etc/os-release | cut -d'=' -f2)/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.4.list +fi + +$STD apt-get update +$STD apt-get install -y mongodb-org +sed -i 's/bindIp: 127.0.0.1/bindIp: 0.0.0.0/' /etc/mongod.conf +systemctl enable -q --now mongod.service +msg_ok "MongoDB 4.4 Installed" + + +msg_info "Installing Petio" +useradd -M --shell=/bin/false petio +mkdir /opt/Petio +wget -q https://petio.tv/releases/latest -O petio-latest.zip +$STD unzip -q petio-latest.zip -d /opt/Petio +rm -rf petio-latest.zip +chown -R petio:petio /opt/Petio +msg_ok "Installed Petio" + +msg_info "Creating Service" +cat </etc/systemd/system/petio.service +[Unit] +Description=Petio a content request system +After=network.target mongod.service + +[Service] +Type=simple +User=petio +Restart=on-failure +RestartSec=1 +ExecStart=/opt/Petio/bin/petio-linux + +[Install] +WantedBy=multi-user.target + + +EOF +systemctl enable -q --now petio.service +msg_ok "Created Service" + + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/photoprism-install.sh b/install/photoprism-install.sh new file mode 100644 index 00000000..8e0df7ab --- /dev/null +++ b/install/photoprism-install.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get install -y curl +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y exiftool +$STD apt-get install -y ffmpeg +$STD apt-get install -y libheif1 +$STD apt-get install -y libpng-dev +$STD apt-get install -y libjpeg-dev +$STD apt-get install -y libtiff-dev +$STD apt-get install -y imagemagick +$STD apt-get install -y darktable +$STD apt-get install -y rawtherapee +$STD apt-get install -y libvips42 + +echo 'export PATH=/usr/local:$PATH' >>~/.bashrc +export PATH=/usr/local:$PATH +msg_ok "Installed Dependencies" + +msg_info "Installing PhotoPrism (Patience)" +mkdir -p /opt/photoprism/{cache,config,photos/originals,photos/import,storage,temp} +wget -q -cO - https://dl.photoprism.app/pkg/linux/amd64.tar.gz | tar -xz -C /opt/photoprism --strip-components=1 +if [[ ${PCT_OSTYPE} == "ubuntu" ]]; then + wget -q -cO - https://dl.photoprism.app/dist/libheif/libheif-jammy-amd64-v1.17.1.tar.gz | tar -xzf - -C /usr/local --strip-components=1 +else + wget -q -cO - https://dl.photoprism.app/dist/libheif/libheif-bookworm-amd64-v1.17.1.tar.gz | tar -xzf - -C /usr/local --strip-components=1 +fi +ldconfig +cat </opt/photoprism/config/.env +PHOTOPRISM_AUTH_MODE='password' +PHOTOPRISM_ADMIN_PASSWORD='changeme' +PHOTOPRISM_HTTP_HOST='0.0.0.0' +PHOTOPRISM_HTTP_PORT='2342' +PHOTOPRISM_SITE_CAPTION='https://tteck.github.io/Proxmox/' +PHOTOPRISM_STORAGE_PATH='/opt/photoprism/storage' +PHOTOPRISM_ORIGINALS_PATH='/opt/photoprism/photos/originals' +PHOTOPRISM_IMPORT_PATH='/opt/photoprism/photos/import' +EOF +ln -sf /opt/photoprism/bin/photoprism /usr/local/bin/photoprism +msg_ok "Installed PhotoPrism" + +msg_info "Creating Service" +cat </etc/systemd/system/photoprism.service +[Unit] +Description=PhotoPrism service +After=network.target + +[Service] +Type=forking +User=root +WorkingDirectory=/opt/photoprism +EnvironmentFile=/opt/photoprism/config/.env +ExecStart=/opt/photoprism/bin/photoprism up -d +ExecStop=/opt/photoprism/bin/photoprism down + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now photoprism +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/pialert-install.sh b/install/pialert-install.sh new file mode 100644 index 00000000..d08f16f7 --- /dev/null +++ b/install/pialert-install.sh @@ -0,0 +1,102 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 -y install \ + sudo \ + mc \ + curl \ + apt-utils \ + avahi-utils \ + lighttpd \ + sqlite3 \ + mmdb-bin \ + arp-scan \ + dnsutils \ + net-tools \ + nbtscan \ + libwww-perl \ + nmap \ + zip \ + aria2 \ + wakeonlan +msg_ok "Installed Dependencies" + +msg_info "Installing PHP Dependencies" +$STD apt-get -y install \ + php \ + php-cgi \ + php-fpm \ + php-curl \ + php-xml \ + php-sqlite3 +$STD lighttpd-enable-mod fastcgi-php +service lighttpd force-reload +msg_ok "Installed PHP Dependencies" + +msg_info "Installing Python Dependencies" +$STD apt-get -y install \ + python3-pip \ + python3-requests +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +$STD pip3 install mac-vendor-lookup +$STD pip3 install fritzconnection +$STD pip3 install cryptography +$STD pip3 install pyunifi +msg_ok "Installed Python Dependencies" + +msg_info "Installing Pi.Alert" +curl -sL https://github.com/leiweibau/Pi.Alert/raw/main/tar/pialert_latest.tar | tar xvf - -C /opt >/dev/null 2>&1 +rm -rf /var/lib/ieee-data /var/www/html/index.html +sed -i -e 's#^sudo cp -n /usr/share/ieee-data/.* /var/lib/ieee-data/#\# &#' -e '/^sudo mkdir -p 2_backup$/s/^/# /' -e '/^sudo cp \*.txt 2_backup$/s/^/# /' -e '/^sudo cp \*.csv 2_backup$/s/^/# /' /opt/pialert/back/update_vendors.sh +mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.html.old +ln -s /usr/share/ieee-data/ /var/lib/ +ln -s /opt/pialert/install/index.html /var/www/html/index.html +ln -s /opt/pialert/front /var/www/html/pialert +chmod go+x /opt/pialert /opt/pialert/back/shoutrrr/x86/shoutrrr +chgrp -R www-data /opt/pialert/db /opt/pialert/front/reports /opt/pialert/config /opt/pialert/config/pialert.conf +chmod -R 775 /opt/pialert/db /opt/pialert/db/temp /opt/pialert/config /opt/pialert/front/reports +touch /opt/pialert/log/pialert.vendors.log /opt/pialert/log/pialert.IP.log /opt/pialert/log/pialert.1.log /opt/pialert/log/pialert.cleanup.log /opt/pialert/log/pialert.webservices.log +src_dir="/opt/pialert/log" +dest_dir="/opt/pialert/front/php/server" +for file in pialert.vendors.log pialert.IP.log pialert.1.log pialert.cleanup.log pialert.webservices.log; do + ln -s "$src_dir/$file" "$dest_dir/$file" +done +sed -i 's#PIALERT_PATH\s*=\s*'\''/home/pi/pialert'\''#PIALERT_PATH = '\''/opt/pialert'\''#' /opt/pialert/config/pialert.conf +sed -i 's/$HOME/\/opt/g' /opt/pialert/install/pialert.cron +crontab /opt/pialert/install/pialert.cron +echo "bash -c \"\$(wget -qLO - https://github.com/leiweibau/Pi.Alert/raw/main/install/pialert_update.sh)\" -s --lxc" >/usr/bin/update +chmod +x /usr/bin/update +echo "python3 /opt/pialert/back/pialert.py 1" >/usr/bin/scan +chmod +x /usr/bin/scan +echo "/opt/pialert/back/pialert-cli set_permissions --lxc" >/usr/bin/permissions +chmod +x /usr/bin/permissions +echo "/opt/pialert/back/pialert-cli set_sudoers --lxc" >/usr/bin/sudoers +chmod +x /usr/bin/sudoers +msg_ok "Installed Pi.Alert" + +msg_info "Start Pi.Alert Scan (Patience)" +$STD python3 /opt/pialert/back/pialert.py update_vendors +$STD python3 /opt/pialert/back/pialert.py internet_IP +$STD python3 /opt/pialert/back/pialert.py 1 +msg_ok "Finished Pi.Alert Scan" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/pihole-install.sh b/install/pihole-install.sh new file mode 100644 index 00000000..7f79ff8c --- /dev/null +++ b/install/pihole-install.sh @@ -0,0 +1,110 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y ufw +$STD apt-get install -y ntp +msg_ok "Installed Dependencies" + +msg_info "Installing Pi-hole" +mkdir -p /etc/pihole/ +cat </etc/pihole/setupVars.conf +PIHOLE_INTERFACE=eth0 +PIHOLE_DNS_1=8.8.8.8 +PIHOLE_DNS_2=8.8.4.4 +QUERY_LOGGING=true +INSTALL_WEB_SERVER=true +INSTALL_WEB_INTERFACE=true +LIGHTTPD_ENABLED=true +CACHE_SIZE=10000 +DNS_FQDN_REQUIRED=true +DNS_BOGUS_PRIV=true +DNSMASQ_LISTENING=local +WEBPASSWORD=$(openssl rand -base64 48) +BLOCKING_ENABLED=true +EOF +# View script https://install.pi-hole.net +$STD bash <(curl -fsSL https://install.pi-hole.net) --unattended +msg_ok "Installed Pi-hole" + +read -r -p "Would you like to add Unbound? " prompt +if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + msg_info "Installing Unbound" + $STD apt-get install -y unbound + cat </etc/unbound/unbound.conf.d/pi-hole.conf +server: + verbosity: 0 + interface: 0.0.0.0 + port: 5335 + do-ip6: no + do-ip4: yes + do-udp: yes + do-tcp: yes + num-threads: 1 + hide-identity: yes + hide-version: yes + harden-glue: yes + harden-dnssec-stripped: yes + harden-referral-path: yes + use-caps-for-id: no + harden-algo-downgrade: no + qname-minimisation: yes + aggressive-nsec: yes + rrset-roundrobin: yes + cache-min-ttl: 300 + cache-max-ttl: 14400 + msg-cache-slabs: 8 + rrset-cache-slabs: 8 + infra-cache-slabs: 8 + key-cache-slabs: 8 + serve-expired: yes + root-hints: /var/lib/unbound/root.hints + serve-expired-ttl: 3600 + edns-buffer-size: 1232 + prefetch: yes + prefetch-key: yes + target-fetch-policy: "3 2 1 1 1" + unwanted-reply-threshold: 10000000 + rrset-cache-size: 256m + msg-cache-size: 128m + so-rcvbuf: 1m + private-address: 192.168.0.0/16 + private-address: 169.254.0.0/16 + private-address: 172.16.0.0/12 + private-address: 10.0.0.0/8 + private-address: fd00::/8 + private-address: fe80::/10 +EOF + mkdir -p /etc/dnsmasq.d/ + cat </etc/dnsmasq.d/99-edns.conf +edns-packet-max=1232 +EOF + wget -qO /var/lib/unbound/root.hints https://www.internic.net/domain/named.root + sed -i -e 's/PIHOLE_DNS_1=8.8.8.8/PIHOLE_DNS_1=127.0.0.1#5335/' -e 's/PIHOLE_DNS_2=8.8.4.4/#PIHOLE_DNS_2=8.8.4.4/' /etc/pihole/setupVars.conf + systemctl enable -q --now unbound + systemctl restart pihole-FTL.service + msg_ok "Installed Unbound" +fi + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/pingvin-install.sh b/install/pingvin-install.sh new file mode 100644 index 00000000..4430cc21 --- /dev/null +++ b/install/pingvin-install.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +$STD npm install pm2 -g +msg_ok "Installed Node.js" + +msg_info "Installing Pingvin Share (Patience)" +git clone -q https://github.com/stonith404/pingvin-share /opt/pingvin-share +cd /opt/pingvin-share +$STD git fetch --tags +$STD git checkout $(git describe --tags `git rev-list --tags --max-count=1`) +cd backend +$STD npm install +$STD npm run build +$STD pm2 start --name="pingvin-share-backend" npm -- run prod +cd ../frontend +sed -i '/"admin.config.smtp.allow-unauthorized-certificates":\|admin.config.smtp.allow-unauthorized-certificates.description":/,+1d' ./src/i18n/translations/fr-FR.ts +$STD npm install +$STD npm run build +$STD pm2 start --name="pingvin-share-frontend" npm -- run start +$STD pm2 startup +msg_ok "Installed Pingvin Share" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/plex-install.sh b/install/plex-install.sh new file mode 100644 index 00000000..1ca8b0d9 --- /dev/null +++ b/install/plex-install.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Setting Up Hardware Acceleration" +$STD apt-get -y install {va-driver-all,ocl-icd-libopencl1,intel-opencl-icd,vainfo,intel-gpu-tools} +if [[ "$CTTYPE" == "0" ]]; then + chgrp video /dev/dri + chmod 755 /dev/dri + chmod 660 /dev/dri/* + $STD adduser $(id -u -n) video + $STD adduser $(id -u -n) render +fi +msg_ok "Set Up Hardware Acceleration" + +msg_info "Setting Up Plex Media Server Repository" +wget -qO- https://downloads.plex.tv/plex-keys/PlexSign.key >/usr/share/keyrings/PlexSign.asc +echo "deb [signed-by=/usr/share/keyrings/PlexSign.asc] https://downloads.plex.tv/repo/deb/ public main" >/etc/apt/sources.list.d/plexmediaserver.list +msg_ok "Set Up Plex Media Server Repository" + +msg_info "Installing Plex Media Server" +$STD apt-get update +$STD apt-get -o Dpkg::Options::="--force-confold" install -y plexmediaserver +if [[ "$CTTYPE" == "0" ]]; then + sed -i -e 's/^ssl-cert:x:104:plex$/render:x:104:root,plex/' -e 's/^render:x:108:root$/ssl-cert:x:108:plex/' /etc/group +else + sed -i -e 's/^ssl-cert:x:104:plex$/render:x:104:plex/' -e 's/^render:x:108:$/ssl-cert:x:108:/' /etc/group +fi +msg_ok "Installed Plex Media Server" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/pocketbase-install.sh b/install/pocketbase-install.sh new file mode 100644 index 00000000..29bf8813 --- /dev/null +++ b/install/pocketbase-install.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Pocketbase" +RELEASE=$(curl -s https://api.github.com/repos/pocketbase/pocketbase/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +wget -q https://github.com/pocketbase/pocketbase/releases/download/v${RELEASE}/pocketbase_${RELEASE}_linux_amd64.zip -O /tmp/pocketbase.zip +mkdir -p /opt/pocketbase/{pb_public,pb_migrations,pb_hooks} +unzip -q -o /tmp/pocketbase.zip -d /opt/pocketbase + +cat </etc/systemd/system/pocketbase.service +[Unit] +Description = pocketbase + +[Service] +Type = simple +LimitNOFILE = 4096 +Restart = always +RestartSec = 5s +StandardOutput = append:/opt/pocketbase/errors.log +StandardError = append:/opt/pocketbase/errors.log +ExecStart = /opt/pocketbase/pocketbase serve --http=0.0.0.0:8080 + +[Install] +WantedBy = multi-user.target +EOF + +systemctl enable -q --now pocketbase.service +msg_ok "Installed Pocketbase" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/podman-homeassistant-install.sh b/install/podman-homeassistant-install.sh new file mode 100644 index 00000000..a82d852e --- /dev/null +++ b/install/podman-homeassistant-install.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Podman" +$STD apt-get -y install podman +$STD systemctl enable --now podman.socket +msg_ok "Installed Podman" + +msg_info "Pulling Home Assistant Image" +$STD podman pull docker.io/homeassistant/home-assistant:stable +msg_ok "Pulled Home Assistant Image" + +msg_info "Installing Home Assistant" +$STD podman volume create hass_config +$STD podman run -d \ + --name homeassistant \ + --restart unless-stopped \ + -v /dev:/dev \ + -v hass_config:/config \ + -v /etc/localtime:/etc/localtime:ro \ + -v /etc/timezone:/etc/timezone:ro \ + --net=host \ + homeassistant/home-assistant:stable +podman generate systemd \ + --new --name homeassistant \ + >/etc/systemd/system/homeassistant.service +$STD systemctl enable --now homeassistant +msg_ok "Installed Home Assistant" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/podman-install.sh b/install/podman-install.sh new file mode 100644 index 00000000..1ef11fdd --- /dev/null +++ b/install/podman-install.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Podman" +$STD apt-get -y install podman +$STD systemctl enable --now podman.socket +echo -e 'unqualified-search-registries=["docker.io"]' >> /etc/containers/registries.conf +msg_ok "Installed Podman" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/postgresql-install.sh b/install/postgresql-install.sh new file mode 100644 index 00000000..3cf51532 --- /dev/null +++ b/install/postgresql-install.sh @@ -0,0 +1,151 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up PostgreSQL Repository" +VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)" +echo "deb http://apt.postgresql.org/pub/repos/apt ${VERSION}-pgdg main" >/etc/apt/sources.list.d/pgdg.list +curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor --output /etc/apt/trusted.gpg.d/postgresql.gpg +msg_ok "Setup PostgreSQL Repository" + +msg_info "Installing PostgreSQL" +$STD apt-get update +$STD apt-get install -y postgresql + +cat </etc/postgresql/16/main/pg_hba.conf +# PostgreSQL Client Authentication Configuration File +local all postgres peer +# TYPE DATABASE USER ADDRESS METHOD +# "local" is for Unix domain socket connections only +local all all peer +# IPv4 local connections: +host all all 127.0.0.1/32 scram-sha-256 +host all all 0.0.0.0/24 md5 +# IPv6 local connections: +host all all ::1/128 scram-sha-256 +host all all 0.0.0.0/0 md5 +# Allow replication connections from localhost, by a user with the +# replication privilege. +local replication all peer +host replication all 127.0.0.1/32 scram-sha-256 +host replication all ::1/128 scram-sha-256 +EOF + +cat </etc/postgresql/16/main/postgresql.conf +# ----------------------------- +# PostgreSQL configuration file +# ----------------------------- + +#------------------------------------------------------------------------------ +# FILE LOCATIONS +#------------------------------------------------------------------------------ + +data_directory = '/var/lib/postgresql/16/main' +hba_file = '/etc/postgresql/16/main/pg_hba.conf' +ident_file = '/etc/postgresql/16/main/pg_ident.conf' +external_pid_file = '/var/run/postgresql/16-main.pid' + +#------------------------------------------------------------------------------ +# CONNECTIONS AND AUTHENTICATION +#------------------------------------------------------------------------------ + +# - Connection Settings - + +listen_addresses = '*' +port = 5432 +max_connections = 100 +unix_socket_directories = '/var/run/postgresql' + +# - SSL - + +ssl = on +ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' +ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' + +#------------------------------------------------------------------------------ +# RESOURCE USAGE (except WAL) +#------------------------------------------------------------------------------ + +shared_buffers = 128MB +dynamic_shared_memory_type = posix + +#------------------------------------------------------------------------------ +# WRITE-AHEAD LOG +#------------------------------------------------------------------------------ + +max_wal_size = 1GB +min_wal_size = 80MB + +#------------------------------------------------------------------------------ +# REPORTING AND LOGGING +#------------------------------------------------------------------------------ + +# - What to Log - + +log_line_prefix = '%m [%p] %q%u@%d ' +log_timezone = 'Etc/UTC' + +#------------------------------------------------------------------------------ +# PROCESS TITLE +#------------------------------------------------------------------------------ + +cluster_name = '16/main' + +#------------------------------------------------------------------------------ +# CLIENT CONNECTION DEFAULTS +#------------------------------------------------------------------------------ + +# - Locale and Formatting - + +datestyle = 'iso, mdy' +timezone = 'Etc/UTC' +lc_messages = 'C' +lc_monetary = 'C' +lc_numeric = 'C' +lc_time = 'C' +default_text_search_config = 'pg_catalog.english' + +#------------------------------------------------------------------------------ +# CONFIG FILE INCLUDES +#------------------------------------------------------------------------------ + +include_dir = 'conf.d' +EOF + +sudo systemctl restart postgresql +msg_ok "Installed PostgreSQL" + +read -r -p "Would you like to add Adminer? " prompt +if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + msg_info "Installing Adminer" + $STD apt install -y adminer + $STD a2enconf adminer + systemctl reload apache2 + msg_ok "Installed Adminer" +fi + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/prometheus-install.sh b/install/prometheus-install.sh new file mode 100644 index 00000000..5d2e95cd --- /dev/null +++ b/install/prometheus-install.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Prometheus" +RELEASE=$(curl -s https://api.github.com/repos/prometheus/prometheus/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +mkdir -p /etc/prometheus +mkdir -p /var/lib/prometheus +$STD wget https://github.com/prometheus/prometheus/releases/download/v${RELEASE}/prometheus-${RELEASE}.linux-amd64.tar.gz +$STD tar -xvf prometheus-${RELEASE}.linux-amd64.tar.gz +cd prometheus-${RELEASE}.linux-amd64 +mv prometheus promtool /usr/local/bin/ +mv consoles/ console_libraries/ /etc/prometheus/ +mv prometheus.yml /etc/prometheus/prometheus.yml +msg_ok "Installed Prometheus" + +msg_info "Creating Service" +service_path="/etc/systemd/system/prometheus.service" +echo "[Unit] +Description=Prometheus +Wants=network-online.target +After=network-online.target + +[Service] +User=root +Restart=always +Type=simple +ExecStart=/usr/local/bin/prometheus \ + --config.file=/etc/prometheus/prometheus.yml \ + --storage.tsdb.path=/var/lib/prometheus/ \ + --web.console.templates=/etc/prometheus/consoles \ + --web.console.libraries=/etc/prometheus/console_libraries \ + --web.listen-address=0.0.0.0:9090 + +[Install] +WantedBy=multi-user.target" >$service_path +$STD sudo systemctl enable --now prometheus +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +rm -rf ../prometheus-${RELEASE}.linux-amd64 ../prometheus-${RELEASE}.linux-amd64.tar.gz +msg_ok "Cleaned" diff --git a/install/prowlarr-install.sh b/install/prowlarr-install.sh new file mode 100644 index 00000000..39a56fac --- /dev/null +++ b/install/prowlarr-install.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y sqlite3 +msg_ok "Installed Dependencies" + +msg_info "Installing Prowlarr" +mkdir -p /var/lib/prowlarr/ +chmod 775 /var/lib/prowlarr/ +$STD wget --content-disposition 'https://prowlarr.servarr.com/v1/update/master/updatefile?os=linux&runtime=netcore&arch=x64' +$STD tar -xvzf Prowlarr.master.*.tar.gz +mv Prowlarr /opt +chmod 775 /opt/Prowlarr +msg_ok "Installed Prowlarr" + +msg_info "Creating Service" +cat </etc/systemd/system/prowlarr.service +[Unit] +Description=Prowlarr Daemon +After=syslog.target network.target +[Service] +UMask=0002 +Type=simple +ExecStart=/opt/Prowlarr/Prowlarr -nobrowser -data=/var/lib/prowlarr/ +TimeoutStopSec=20 +KillMode=process +Restart=on-failure +[Install] +WantedBy=multi-user.target +EOF +systemctl -q daemon-reload +systemctl enable --now -q prowlarr +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf Prowlarr.master.*.tar.gz +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/qbittorrent-install.sh b/install/qbittorrent-install.sh new file mode 100644 index 00000000..a1c0064f --- /dev/null +++ b/install/qbittorrent-install.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing qbittorrent-nox" +$STD apt-get install -y qbittorrent-nox +mkdir -p /.config/qBittorrent/ +cat </.config/qBittorrent/qBittorrent.conf +[Preferences] +WebUI\Password_PBKDF2="@ByteArray(amjeuVrF3xRbgzqWQmes5A==:XK3/Ra9jUmqUc4RwzCtrhrkQIcYczBl90DJw2rT8DFVTss4nxpoRhvyxhCf87ahVE3SzD8K9lyPdpyUCfmVsUg==)" +WebUI\Port=8090 +WebUI\UseUPnP=false +WebUI\Username=admin +EOF +msg_ok "qbittorrent-nox" + +msg_info "Creating Service" +cat </etc/systemd/system/qbittorrent-nox.service +[Unit] +Description=qBittorrent client +After=network.target +[Service] +ExecStart=/usr/bin/qbittorrent-nox --webui-port=8090 +Restart=always +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now qbittorrent-nox +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/rabbitmq-install.sh b/install/rabbitmq-install.sh new file mode 100644 index 00000000..5824c0f5 --- /dev/null +++ b/install/rabbitmq-install.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +# Source: https://www.rabbitmq.com/ + +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 \ + sudo \ + lsb-release \ + curl \ + gnupg \ + apt-transport-https \ + make \ + mc +msg_ok "Installed Dependencies" + +msg_info "Adding RabbitMQ signing key" +wget -qO- "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | gpg --dearmor >/usr/share/keyrings/com.rabbitmq.team.gpg +wget -qO- "https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-erlang.E495BB49CC4BBE5B.key" | gpg --dearmor >/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg +wget -qO- "https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-server.9F4587F226208342.key" | gpg --dearmor >/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg +msg_ok "Signing keys added" + +msg_info "Adding RabbitMQ repository" +cat </etc/apt/sources.list.d/rabbitmq.list +## Provides modern Erlang/OTP releases from a Cloudsmith mirror +deb [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/deb/debian $(lsb_release -cs) main +deb-src [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/deb/debian $(lsb_release -cs) main + +## Provides RabbitMQ from a Cloudsmith mirror +deb [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/deb/debian $(lsb_release -cs) main +deb-src [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/deb/debian $(lsb_release -cs) main +EOF +msg_ok "RabbitMQ repository added" + +msg_info "Updating package list" +$STD apt-get update -y +msg_ok "Package list updated" + +msg_info "Installing Erlang & RabbitMQ server" +$STD apt-get install -y erlang-base \ + erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets \ + erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key \ + erlang-runtime-tools erlang-snmp erlang-ssl \ + erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl \ + rabbitmq-server +msg_ok "RabbitMQ server installed" + +msg_info "Starting RabbitMQ service" +systemctl enable -q --now rabbitmq-server +msg_ok "RabbitMQ service started" + +msg_info "Enabling RabbitMQ management plugin" +$STD rabbitmq-plugins enable rabbitmq_management +$STD rabbitmqctl enable_feature_flag all +msg_ok "RabbitMQ management plugin enabled" + +msg_info "Create User" +$STD rabbitmqctl add_user proxmox proxmox +$STD rabbitmqctl set_user_tags proxmox administrator +$STD rabbitmqctl set_permissions -p / proxmox ".*" ".*" ".*" +msg_ok "Created User" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/radarr-install.sh b/install/radarr-install.sh new file mode 100644 index 00000000..dc074251 --- /dev/null +++ b/install/radarr-install.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y sqlite3 +msg_ok "Installed Dependencies" + +msg_info "Installing Radarr" +mkdir -p /var/lib/radarr/ +chmod 775 /var/lib/radarr/ +$STD wget --content-disposition 'https://radarr.servarr.com/v1/update/master/updatefile?os=linux&runtime=netcore&arch=x64' +$STD tar -xvzf Radarr.master.*.tar.gz +mv Radarr /opt +chmod 775 /opt/Radarr +msg_ok "Installed Radarr" + +msg_info "Creating Service" +cat </etc/systemd/system/radarr.service +[Unit] +Description=Radarr Daemon +After=syslog.target network.target +[Service] +UMask=0002 +Type=simple +ExecStart=/opt/Radarr/Radarr -nobrowser -data=/var/lib/radarr/ +TimeoutStopSec=20 +KillMode=process +Restart=on-failure +[Install] +WantedBy=multi-user.target +EOF +systemctl -q daemon-reload +systemctl enable --now -q radarr +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf Radarr.master.*.tar.gz +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/rdtclient-install.sh b/install/rdtclient-install.sh new file mode 100644 index 00000000..652998aa --- /dev/null +++ b/install/rdtclient-install.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y unzip +msg_ok "Installed Dependencies" + +msg_info "Installing ASP.NET Core Runtime" +wget -q https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb +$STD dpkg -i packages-microsoft-prod.deb +rm packages-microsoft-prod.deb +$STD apt-get update +$STD apt-get install -y dotnet-sdk-8.0 +msg_ok "Installed ASP.NET Core Runtime" + +msg_info "Installing rdtclient" +wget -q https://github.com/rogerfar/rdt-client/releases/latest/download/RealDebridClient.zip +unzip -qq RealDebridClient.zip -d /opt/rdtc +rm RealDebridClient.zip +cd /opt/rdtc +mkdir -p data/{db,downloads} +sed -i 's#/data/db/#/opt/rdtc&#g' /opt/rdtc/appsettings.json +msg_ok "Installed rdtclient" + +msg_info "Creating Service" +cat </etc/systemd/system/rdtc.service +[Unit] +Description=RdtClient Service + +[Service] +WorkingDirectory=/opt/rdtc +ExecStart=/usr/bin/dotnet RdtClient.Web.dll +SyslogIdentifier=RdtClient +User=root + +[Install] +WantedBy=multi-user.target +EOF +$STD systemctl enable -q --now rdtc +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/readarr-install.sh b/install/readarr-install.sh new file mode 100644 index 00000000..c3afc66d --- /dev/null +++ b/install/readarr-install.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y sqlite3 +msg_ok "Installed Dependencies" + +msg_info "Installing Readarr" +mkdir -p /var/lib/readarr/ +chmod 775 /var/lib/readarr/ +$STD wget --content-disposition 'https://readarr.servarr.com/v1/update/develop/updatefile?os=linux&runtime=netcore&arch=x64' +$STD tar -xvzf Readarr.develop.*.tar.gz +mv Readarr /opt +chmod 775 /opt/Readarr +msg_ok "Installed Readarr" + +msg_info "Creating Service" +cat </etc/systemd/system/readarr.service +[Unit] +Description=Readarr Daemon +After=syslog.target network.target +[Service] +UMask=0002 +Type=simple +ExecStart=/opt/Readarr/Readarr -nobrowser -data=/var/lib/readarr/ +TimeoutStopSec=20 +KillMode=process +Restart=on-failure +[Install] +WantedBy=multi-user.target +EOF +systemctl -q daemon-reload +systemctl enable --now -q readarr +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf Readarr.develop.*.tar.gz +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/readeck-install.sh b/install/readeck-install.sh new file mode 100644 index 00000000..dbc1d5e8 --- /dev/null +++ b/install/readeck-install.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Readeck" +LATEST=$(curl -s https://codeberg.org/readeck/readeck/releases/ | grep -oP '(?<=Version )\d+\.\d+\.\d+' | head -1) +mkdir -p /opt/readeck +cd /opt/readeck +wget -q -O readeck https://codeberg.org/readeck/readeck/releases/download/${LATEST}/readeck-${LATEST}-linux-amd64 +chmod a+x readeck +msg_ok "Installed Readeck" + +msg_info "Creating Service" +cat </etc/systemd/system/readeck.service +[Unit] +Description=Readeck Service +After=network.target + +[Service] +Environment=READECK_SERVER_HOST=0.0.0.0 +Environment=READECK_SERVER_PORT=8000 +ExecStart=/opt/readeck/./readeck serve +WorkingDirectory=/opt/readeck +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now readeck.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/redis-install.sh b/install/redis-install.sh new file mode 100644 index 00000000..488d787a --- /dev/null +++ b/install/redis-install.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y apt-transport-https +$STD apt-get install -y gpg +$STD apt-get install -y lsb-release +msg_ok "Installed Dependencies" + +msg_info "Installing Redis" +wget -qO- https://packages.redis.io/gpg | gpg --dearmor >/usr/share/keyrings/redis-archive-keyring.gpg +echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" >/etc/apt/sources.list.d/redis.list +$STD apt-get update +$STD apt-get install -y redis +sed -i 's/^bind .*/bind 0.0.0.0/' /etc/redis/redis.conf +systemctl enable -q --now redis-server.service +msg_ok "Installed Redis" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/rtsptoweb-install.sh b/install/rtsptoweb-install.sh new file mode 100644 index 00000000..d8e5ecab --- /dev/null +++ b/install/rtsptoweb-install.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y git +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Golang" +$STD wget https://golang.org/dl/go1.20.1.linux-amd64.tar.gz +$STD tar -xzf go1.20.1.linux-amd64.tar.gz -C /usr/local +$STD ln -s /usr/local/go/bin/go /usr/local/bin/go +rm -rf go1.20.1.linux-amd64.tar.gz +msg_ok "Installed Golang" + +msg_info "Installing RTSPtoWeb" +$STD git clone https://github.com/deepch/RTSPtoWeb /opt/rtsptoweb +cat <>/opt/rtsptoweb/start +#!/bin/bash +cd /opt/rtsptoweb && GO111MODULE=on go run *.go +EOF +chmod +x /opt/rtsptoweb/start +msg_ok "Installed RTSPtoWeb" + +msg_info "Creating Service" +service_path="/etc/systemd/system/rtsptoweb.service" +echo "[Unit] +Description=RTSP to Web Streaming Service +After=network.target + +[Service] +Type=simple +User=root +ExecStart=/opt/rtsptoweb/start + +[Install] +WantedBy=multi-user.target" >$service_path +systemctl enable -q --now rtsptoweb +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/runtipi-install.sh b/install/runtipi-install.sh new file mode 100644 index 00000000..f39bb3af --- /dev/null +++ b/install/runtipi-install.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Runtipi (Patience)" +DOCKER_CONFIG_PATH='/etc/docker/daemon.json' +mkdir -p "$(dirname "$DOCKER_CONFIG_PATH")" +echo -e '{\n "log-driver": "journald"\n}' > "$DOCKER_CONFIG_PATH" +cd /opt +wget -q https://raw.githubusercontent.com/runtipi/runtipi/master/scripts/install.sh +chmod +x install.sh +$STD ./install.sh +chmod 666 /opt/runtipi/state/settings.json +msg_ok "Installed Runtipi" + +motd_ssh +customize + +msg_info "Cleaning up" +rm /opt/install.sh +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/sabnzbd-install.sh b/install/sabnzbd-install.sh new file mode 100644 index 00000000..efeb7c0f --- /dev/null +++ b/install/sabnzbd-install.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y par2 +$STD apt-get install -y p7zip-full +cat </etc/apt/sources.list.d/non-free.list +deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware +EOF +$STD apt-get update +$STD apt-get install -y unrar +rm /etc/apt/sources.list.d/non-free.list +msg_ok "Installed Dependencies" + +msg_info "Updating Python3" +$STD apt-get install -y \ + python3-dev \ + python3-pip +$STD apt-get install -y python3-setuptools +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Updated Python3" + +msg_info "Installing SABnzbd" +RELEASE=$(curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +$STD tar zxvf <(curl -fsSL https://github.com/sabnzbd/sabnzbd/releases/download/$RELEASE/SABnzbd-${RELEASE}-src.tar.gz) +mv SABnzbd-${RELEASE} /opt/sabnzbd +cd /opt/sabnzbd +$STD python3 -m pip install -r requirements.txt +msg_ok "Installed SABnzbd" + +msg_info "Creating Service" +service_path="/etc/systemd/system/sabnzbd.service" +echo "[Unit] +Description=SABnzbd +After=network.target +[Service] +WorkingDirectory=/opt/sabnzbd +ExecStart=python3 SABnzbd.py -s 0.0.0.0:7777 +Restart=always +User=root +[Install] +WantedBy=multi-user.target" >$service_path +systemctl enable --now -q sabnzbd.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/scrypted-install.sh b/install/scrypted-install.sh new file mode 100644 index 00000000..ad71ba92 --- /dev/null +++ b/install/scrypted-install.sh @@ -0,0 +1,136 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get -y install software-properties-common apt-utils +$STD apt-get -y update +$STD apt-get -y upgrade +$STD apt-get install -y avahi-daemon +$STD apt-get -y install \ + build-essential \ + gcc \ + gir1.2-gtk-3.0 \ + libcairo2-dev \ + libgirepository1.0-dev \ + libglib2.0-dev \ + libjpeg-dev \ + libgif-dev \ + libopenjp2-7 \ + libpango1.0-dev \ + librsvg2-dev \ + pkg-config \ + curl \ + sudo \ + mc \ + ca-certificates \ + gpg +msg_ok "Installed Dependencies" + +msg_info "Setting Up Hardware Acceleration" +$STD apt-get -y install {va-driver-all,ocl-icd-libopencl1,intel-opencl-icd,vainfo,intel-gpu-tools} +if [[ "$CTTYPE" == "0" ]]; then + chgrp video /dev/dri + chmod 755 /dev/dri + chmod 660 /dev/dri/* + $STD adduser $(id -u -n) video + $STD adduser $(id -u -n) render +fi +msg_ok "Set Up Hardware Acceleration" + +msg_info "Installing GStreamer (Patience)" +$STD apt-get -y install \ + gstreamer1.0-tools \ + libgstreamer1.0-dev \ + libgstreamer-plugins-base1.0-dev \ + libgstreamer-plugins-bad1.0-dev \ + gstreamer1.0-plugins-base \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-plugins-ugly \ + gstreamer1.0-libav \ + gstreamer1.0-alsa +msg_ok "Installed GStreamer" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Updating Python3" +$STD apt-get install -y \ + python3 \ + python3-dev \ + python3-pip +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Updated Python3" + +msg_info "Installing Python3 Dependencies" +$STD apt-get -y install \ + python3-gi \ + python3-gst-1.0 \ + python3-matplotlib \ + python3-numpy \ + python3-opencv \ + python3-pil \ + python3-setuptools \ + python3-skimage \ + python3-wheel +$STD python3 -m pip install --upgrade pip +$STD python3 -m pip install aiofiles debugpy typing_extensions typing +msg_ok "Installed Python3 Dependencies" + +msg_info "Installing Scrypted" +$STD npx -y scrypted@latest install-server + +if [[ "$CTTYPE" == "0" ]]; then + sed -i -e 's/^sgx:x:104:$/render:x:104:root/' -e 's/^render:x:106:root$/sgx:x:106:/' /etc/group +else + sed -i -e 's/^sgx:x:104:$/render:x:104:/' -e 's/^render:x:106:$/sgx:x:106:/' /etc/group +fi +msg_ok "Installed Scrypted" + +msg_info "Creating Service" +cat </etc/systemd/system/scrypted.service +[Unit] +Description=Scrypted service +After=network.target + +[Service] +User=root +Group=root +Type=simple +ExecStart=/usr/bin/npx -y scrypted serve +Restart=on-failure +RestartSec=3 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now scrypted.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/sftpgo-install.sh b/install/sftpgo-install.sh new file mode 100644 index 00000000..809ac74c --- /dev/null +++ b/install/sftpgo-install.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +$STD apt-get install -y sqlite3 +msg_ok "Installed Dependencies" + +msg_info "Installing Golang" +set +o pipefail +RELEASE=$(curl -s https://go.dev/dl/ | grep -o "go.*\linux-amd64.tar.gz" | head -n 1) +wget -q https://golang.org/dl/$RELEASE +tar -xzf $RELEASE -C /usr/local +$STD ln -s /usr/local/go/bin/go /usr/local/bin/go +set -o pipefail +msg_ok "Installed Golang" + +msg_info "Installing SFTPGo" +curl -sS https://ftp.osuosl.org/pub/sftpgo/apt/gpg.key | gpg --dearmor -o /usr/share/keyrings/sftpgo-archive-keyring.gpg +echo "deb [signed-by=/usr/share/keyrings/sftpgo-archive-keyring.gpg] https://ftp.osuosl.org/pub/sftpgo/apt bookworm main" >/etc/apt/sources.list.d/sftpgo.list +$STD apt-get update +$STD apt-get install -y sftpgo +msg_ok "Installed SFTPGo" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf $RELEASE +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/shinobi-install.sh b/install/shinobi-install.sh new file mode 100644 index 00000000..82545835 --- /dev/null +++ b/install/shinobi-install.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 sudo git mc +$STD apt-get install -y make zip net-tools +$STD apt-get install -y gcc g++ cmake +$STD apt-get install -y ca-certificates +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing FFMPEG" +$STD apt-get install -y ffmpeg +msg_ok "Installed FFMPEG" + +msg_info "Cloning Shinobi" +cd /opt +$STD git clone https://gitlab.com/Shinobi-Systems/Shinobi.git -b master Shinobi +cd Shinobi +gitVersionNumber=$(git rev-parse HEAD) +theDateRightNow=$(date) +touch version.json +chmod 777 version.json +echo '{"Product" : "'"Shinobi"'" , "Branch" : "'"master"'" , "Version" : "'"$gitVersionNumber"'" , "Date" : "'"$theDateRightNow"'" , "Repository" : "'"https://gitlab.com/Shinobi-Systems/Shinobi.git"'"}' > version.json +msg_ok "Cloned Shinobi" + +msg_info "Installing Database" +sqluser="root" +sqlpass="root" +echo "mariadb-server mariadb-server/root_password password $sqlpass" | debconf-set-selections +echo "mariadb-server mariadb-server/root_password_again password $sqlpass" | debconf-set-selections +$STD apt-get install -y mariadb-server +service mysql start +mysql -u "$sqluser" -p"$sqlpass" -e "source sql/user.sql" || true +msg_ok "Installed Database" + +msg_info "Installing Shinobi" +cp conf.sample.json conf.json +cronKey=$(head -c 1024 < /dev/urandom | sha256sum | awk '{print substr($1,1,29)}') +sed -i -e 's/Shinobi/'"$cronKey"'/g' conf.json +cp super.sample.json super.json +$STD npm i npm -g +$STD npm install --unsafe-perm +$STD npm install pm2@latest -g +chmod -R 755 . +touch INSTALL/installed.txt +ln -s /opt/Shinobi/INSTALL/shinobi /usr/bin/shinobi +node /opt/Shinobi/tools/modifyConfiguration.js addToConfig="{\"cron\":{\"key\":\"$(head -c 64 < /dev/urandom | sha256sum | awk '{print substr($1,1,60)}')\"}}" &>/dev/null +$STD pm2 start camera.js +$STD pm2 start cron.js +$STD pm2 startup +$STD pm2 save +$STD pm2 list +msg_ok "Installed Shinobi" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/smokeping-install.sh b/install/smokeping-install.sh new file mode 100644 index 00000000..0df5c842 --- /dev/null +++ b/install/smokeping-install.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing SmokePing" +$STD apt-get install -y smokeping +cat </etc/smokeping/config.d/Targets +*** Targets *** +probe = FPing +menu = Top +title = Network Latency Grapher +remark = Welcome to SmokePing. ++ Local +menu = Local +title = Local Network (ICMP) +++ LocalMachine +menu = Local Machine +title = This host +host = localhost ++ DNS +menu = DNS latency +title = DNS latency (ICMP) +++ Google +title = Google +host = 8.8.8.8 +++ Cloudflare +title = Cloudflare +host = 1.1.1.1 +++ Quad9 +title = Quad9 +host = 9.9.9.9 +++ OpenDNS +title = OpenDNS +host = 208.67.222.222 ++ HTTP +menu = HTTP latency +title = HTTP latency (ICMP) +++ Github +host = github.com +++ Discord +host = discord.com +++ Google +host = google.com +++ Cloudflare +host = cloudflare.com +++ Amazon +host = amazon.com +++ Netflix +host = netflix.com +EOF +systemctl restart smokeping +msg_ok "Installed SmokePing" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/sonarr-install.sh b/install/sonarr-install.sh new file mode 100644 index 00000000..79060e79 --- /dev/null +++ b/install/sonarr-install.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y sqlite3 +msg_ok "Installed Dependencies" + +msg_info "Installing Sonarr v4" +mkdir -p /var/lib/sonarr/ +chmod 775 /var/lib/sonarr/ +wget -q -O SonarrV4.tar.gz 'https://services.sonarr.tv/v1/download/main/latest?version=4&os=linux&arch=x64' +tar -xzf SonarrV4.tar.gz +mv Sonarr /opt +rm -rf SonarrV4.tar.gz + +msg_ok "Installed Sonarr v4" + +msg_info "Creating Service" +cat </etc/systemd/system/sonarr.service +[Unit] +Description=Sonarr Daemon +After=syslog.target network.target +[Service] +Type=simple +ExecStart=/opt/Sonarr/Sonarr -nobrowser -data=/var/lib/sonarr/ +TimeoutStopSec=20 +KillMode=process +Restart=on-failure +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now sonarr.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/spoolman-install.sh b/install/spoolman-install.sh new file mode 100644 index 00000000..dc2bc31d --- /dev/null +++ b/install/spoolman-install.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +# Source: https://github.com/Donkie/Spoolman + +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 \ + build-essential \ + curl \ + sudo \ + make \ + libpq-dev \ + gpg \ + ca-certificates \ + mc +msg_ok "Installed Dependencies" + +msg_info "Installing Python3" +$STD apt-get install -y \ + python3-dev \ + python3-setuptools \ + python3-wheel \ + python3-pip +msg_ok "Installed Python3" + +msg_info "Installing Spoolman" +cd /opt +RELEASE=$(wget -q https://github.com/Donkie/Spoolman/releases/latest -O - | grep "title>Release" | cut -d " " -f 4) +cd /opt +wget -q https://github.com/Donkie/Spoolman/releases/download/$RELEASE/spoolman.zip +unzip -q spoolman.zip -d spoolman +rm -rf spoolman.zip +cd spoolman +$STD pip3 install -r requirements.txt +cp .env.example .env +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed Spoolman" + +msg_info "Creating Service" +cat </etc/systemd/system/spoolman.service +[Unit] +Description=Spoolman +After=network.target +[Service] +Type=simple +WorkingDirectory=/opt/spoolman +EnvironmentFile=/opt/spoolman/.env +ExecStart=uvicorn spoolman.main:app --host 0.0.0.0 --port 7912 +Restart=always +User=root +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now spoolman.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/stirling-pdf-install.sh b/install/stirling-pdf-install.sh new file mode 100644 index 00000000..88456a66 --- /dev/null +++ b/install/stirling-pdf-install.sh @@ -0,0 +1,121 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get install -y \ + curl \ + sudo \ + mc \ + git \ + automake \ + autoconf \ + libtool \ + libleptonica-dev \ + pkg-config \ + zlib1g-dev \ + make \ + g++ \ + unpaper \ + ocrmypdf +msg_ok "Installed Dependencies" + +msg_info "Installing LibreOffice Components" +$STD apt-get install -y \ + libreoffice-writer \ + libreoffice-calc \ + libreoffice-impress +msg_ok "Installed LibreOffice Components" + +msg_info "Installing Python Dependencies" +$STD apt-get install -y \ + python3 \ + python3-pip +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +$STD pip3 install \ + uno \ + opencv-python-headless \ + unoconv \ + pngquant \ + WeasyPrint +msg_ok "Installed Python Dependencies" + +msg_info "Installing Azul Zulu" +wget -qO /etc/apt/trusted.gpg.d/zulu-repo.asc "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xB1998361219BD9C9" +wget -q https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-3_all.deb +$STD dpkg -i zulu-repo_1.0.0-3_all.deb +$STD apt-get update +$STD apt-get -y install zulu17-jdk +msg_ok "Installed Azul Zulu" + +msg_info "Installing JBIG2" +$STD git clone https://github.com/agl/jbig2enc /opt/jbig2enc +cd /opt/jbig2enc +$STD bash ./autogen.sh +$STD bash ./configure +$STD make +$STD make install +msg_ok "Installed JBIG2" + +msg_info "Installing Language Packs (Patience)" +$STD apt-get install -y 'tesseract-ocr-*' +msg_ok "Installed Language Packs" + +msg_info "Installing Stirling-PDF (Additional Patience)" +RELEASE=$(curl -s https://api.github.com/repos/Stirling-Tools/Stirling-PDF/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +wget -q https://github.com/Stirling-Tools/Stirling-PDF/archive/refs/tags/v$RELEASE.tar.gz +tar -xzf v$RELEASE.tar.gz +cd Stirling-PDF-$RELEASE +chmod +x ./gradlew +$STD ./gradlew build +mkdir -p /opt/Stirling-PDF +touch /opt/Stirling-PDF/.env +mv ./build/libs/Stirling-PDF-*.jar /opt/Stirling-PDF/ +mv scripts /opt/Stirling-PDF/ +ln -s /opt/Stirling-PDF/Stirling-PDF-$RELEASE.jar /opt/Stirling-PDF/Stirling-PDF.jar +ln -s /usr/share/tesseract-ocr/5/tessdata/ /usr/share/tessdata +msg_ok "Installed Stirling-PDF v$RELEASE" + +msg_info "Creating Service" +cat </etc/systemd/system/stirlingpdf.service +[Unit] +Description=Stirling-PDF service +After=syslog.target network.target + +[Service] +SuccessExitStatus=143 + +User=root +Group=root + +Type=simple +EnvironmentFile=/opt/Stirling-PDF/.env +WorkingDirectory=/opt/Stirling-PDF +ExecStart=/usr/bin/java -jar Stirling-PDF.jar +ExecStop=/bin/kill -15 %n + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now stirlingpdf.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf v$RELEASE.tar.gz /zulu-repo_1.0.0-3_all.deb +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/syncthing-install.sh b/install/syncthing-install.sh new file mode 100644 index 00000000..11b45673 --- /dev/null +++ b/install/syncthing-install.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Installing Syncthing" +curl -sL -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg +sh -c 'echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" > /etc/apt/sources.list.d/syncthing.list' +$STD apt-get update +$STD apt-get install -y syncthing +$STD systemctl enable syncthing@root.service +systemctl start syncthing@root.service +sleep 5 +sed -i "{s/127.0.0.1:8384/0.0.0.0:8384/g}" /root/.local/state/syncthing/config.xml +systemctl restart syncthing@root.service +msg_ok "Installed Syncthing" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/tandoor-install.sh b/install/tandoor-install.sh new file mode 100644 index 00000000..53f88333 --- /dev/null +++ b/install/tandoor-install.sh @@ -0,0 +1,147 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get install -y --no-install-recommends \ + build-essential \ + libpq-dev \ + libmagic-dev \ + libzbar0 \ + nginx \ + libsasl2-dev \ + libldap2-dev \ + libssl-dev \ + gpg \ + curl \ + sudo \ + git \ + make \ + mc +msg_ok "Installed Dependencies" + +msg_info "Updating Python3" +$STD apt-get install -y \ + python3 \ + python3-dev \ + python3-setuptools \ + python3-pip +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Updated Python3" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +$STD npm install -g yarn +msg_ok "Installed Node.js" + +msg_info "Installing Tandoor (Patience)" +$STD git clone https://github.com/vabene1111/recipes.git -b master /opt/tandoor +mkdir -p /opt/tandoor/{config,api,mediafiles,staticfiles} +$STD pip3 install -r /opt/tandoor/requirements.txt +cd /opt/tandoor/vue +$STD yarn install +$STD yarn build +wget -q https://raw.githubusercontent.com/vabene1111/recipes/develop/.env.template -O /opt/tandoor/.env +DB_NAME=db_recipes +DB_USER=tandoor +DB_ENCODING=utf8 +DB_TIMEZONE=UTC +secret_key=$(openssl rand -base64 45 | sed 's/\//\\\//g') +DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" +sed -i -e "s|SECRET_KEY=.*|SECRET_KEY=$secret_key|g" \ + -e "s|POSTGRES_HOST=.*|POSTGRES_HOST=localhost|g" \ + -e "s|POSTGRES_PASSWORD=.*|POSTGRES_PASSWORD=$DB_PASS|g" \ + -e "s|POSTGRES_DB=.*|POSTGRES_DB=$DB_NAME|g" \ + -e "s|POSTGRES_USER=.*|POSTGRES_USER=$DB_USER|g" \ + -e "\$a\STATIC_URL=/staticfiles/" /opt/tandoor/.env +msg_ok "Installed Tandoor" + +msg_info "Install/Set up PostgreSQL Database" +curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc|gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg +echo "deb https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" >/etc/apt/sources.list.d/pgdg.list +$STD apt-get update +$STD apt-get install -y postgresql-16 +$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" +$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" +echo "" >>~/tandoor.creds +echo -e "Tandoor Database Name: \e[32m$DB_NAME\e[0m" >>~/tandoor.creds +echo -e "Tandoor Database User: \e[32m$DB_USER\e[0m" >>~/tandoor.creds +echo -e "Tandoor Database Password: \e[32m$DB_PASS\e[0m" >>~/tandoor.creds +export $(cat /opt/tandoor/.env |grep "^[^#]" | xargs) +/usr/bin/python3 /opt/tandoor/manage.py migrate >/dev/null 2>&1 +/usr/bin/python3 /opt/tandoor/manage.py collectstatic --no-input >/dev/null 2>&1 +/usr/bin/python3 /opt/tandoor/manage.py collectstatic_js_reverse >/dev/null 2>&1 +msg_ok "Set up PostgreSQL Database" + +msg_info "Creating Services" +cat </etc/systemd/system/gunicorn_tandoor.service +[Unit] +Description=gunicorn daemon for tandoor +After=network.target + +[Service] +Type=simple +Restart=always +RestartSec=3 +WorkingDirectory=/opt/tandoor +EnvironmentFile=/opt/tandoor/.env +ExecStart=/usr/local/bin/gunicorn --error-logfile /tmp/gunicorn_err.log --log-level debug --capture-output --bind unix:/opt/tandoor/tandoor.sock recipes.wsgi:application + +[Install] +WantedBy=multi-user.target +EOF + +cat << 'EOF' >/etc/nginx/conf.d/tandoor.conf +server { + listen 8002; + #access_log /var/log/nginx/access.log; + #error_log /var/log/nginx/error.log; + client_max_body_size 128M; + # serve media files + location /static/ { + alias /opt/tandoor/staticfiles/; + } + + location /media/ { + alias /opt/tandoor/mediafiles/; + } + + location / { + proxy_set_header Host $http_host; + proxy_pass http://unix:/opt/tandoor/tandoor.sock; + } +} +EOF +systemctl reload nginx +systemctl enable -q --now gunicorn_tandoor +msg_ok "Created Services" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/tasmoadmin-install.sh b/install/tasmoadmin-install.sh new file mode 100644 index 00000000..f0302945 --- /dev/null +++ b/install/tasmoadmin-install.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y apache2 +$STD apt-get install -y php8.2 +$STD apt-get install -y libapache2-mod-php +$STD apt-get install -y php8.2-curl +$STD apt-get install -y php8.2-zip +$STD apt-get install -y php8.2-mbstring +$STD apt-get install -y php8.2-xml +$STD apt-get install -y git +msg_ok "Installed Dependencies" + +msg_info "Installing TasmoAdmin" +wget -q https://github.com/TasmoAdmin/TasmoAdmin/releases/download/v3.1.1/tasmoadmin_v3.1.1.tar.gz +tar -xzf tasmoadmin_v3.1.1.tar.gz -C /var/www/ +rm -rf tasmoadmin_v3.1.1.tar.gz /etc/php/8.2/apache2/conf.d/10-opcache.ini +chown -R www-data:www-data /var/www/tasmoadmin +chmod 777 /var/www/tasmoadmin/tmp /var/www/tasmoadmin/data +cat </etc/apache2/sites-available/tasmoadmin.conf + + ServerName tasmoadmin + ServerAdmin webmaster@localhost + DocumentRoot /var/www/tasmoadmin + + AllowOverride All + Order allow,deny + allow from all + + ErrorLog /var/log/apache2/error.log + LogLevel warn + CustomLog /var/log/apache2/access.log combined + ServerSignature On + +EOF +sed -i '6iListen 9999' /etc/apache2/ports.conf +$STD a2ensite tasmoadmin +$STD a2enmod rewrite +systemctl reload apache2 +systemctl restart apache2 +msg_ok "Installed TasmoAdmin" +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/tautulli-install.sh b/install/tautulli-install.sh new file mode 100644 index 00000000..23408390 --- /dev/null +++ b/install/tautulli-install.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y pip +msg_ok "Installed Dependencies" + +msg_info "Updating Python3" +$STD apt-get install -y \ + python3 \ + python3-dev \ + python3-pip +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Updated Python3" + +msg_info "Installing Tautulli" +cd /opt +$STD git clone https://github.com/Tautulli/Tautulli.git +$STD pip install -q -r /opt/Tautulli/requirements.txt +$STD pip install pyopenssl +msg_ok "Installed Tautulli" + +msg_info "Creating Service" +cat </etc/systemd/system/tautulli.service +[Unit] +Description=Tautulli +After=syslog.target network.target + +[Service] +WorkingDirectory=/opt/Tautulli/ +Restart=on-failure +RestartSec=5 +Type=simple +ExecStart=/usr/bin/python3 /opt/Tautulli/Tautulli.py +KillSignal=SIGINT +TimeoutStopSec=20 +SyslogIdentifier=tautulli + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now tautulli +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/tdarr-install.sh b/install/tdarr-install.sh new file mode 100644 index 00000000..dccd9428 --- /dev/null +++ b/install/tdarr-install.sh @@ -0,0 +1,104 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y handbrake-cli +msg_ok "Installed Dependencies" + +msg_info "Setting Up Hardware Acceleration" +$STD apt-get -y install {va-driver-all,ocl-icd-libopencl1,intel-opencl-icd,vainfo,intel-gpu-tools} +if [[ "$CTTYPE" == "0" ]]; then + chgrp video /dev/dri + chmod 755 /dev/dri + chmod 660 /dev/dri/* + $STD adduser $(id -u -n) video + $STD adduser $(id -u -n) render +fi +msg_ok "Set Up Hardware Acceleration" + +msg_info "Installing Tdarr" +mkdir -p /opt/tdarr +cd /opt/tdarr +RELEASE=$(curl -s https://f000.backblazeb2.com/file/tdarrs/versions.json | grep -oP '(?<="Tdarr_Updater": ")[^"]+' | grep linux_x64 | head -n 1) +wget -q $RELEASE +$STD unzip Tdarr_Updater.zip +rm -rf Tdarr_Updater.zip +chmod +x Tdarr_Updater +./Tdarr_Updater &>/dev/null +if [[ "$CTTYPE" == "0" ]]; then + sed -i -e 's/^sgx:x:104:$/render:x:104:root/' -e 's/^render:x:106:root$/sgx:x:106:/' /etc/group +else + sed -i -e 's/^sgx:x:104:$/render:x:104:/' -e 's/^render:x:106:$/sgx:x:106:/' /etc/group +fi + +msg_ok "Installed Tdarr" + +msg_info "Creating Service" +service_path="/etc/systemd/system/tdarr-server.service" +echo "[Unit] +Description=Tdarr Server Daemon +After=network.target +# Enable if using ZFS, edit and enable if other FS mounting is required to access directory +#Requires=zfs-mount.service + +[Service] +User=root +Group=root + +Type=simple +WorkingDirectory=/opt/tdarr/Tdarr_Server +ExecStartPre=/opt/tdarr/Tdarr_Updater +ExecStart=/opt/tdarr/Tdarr_Server/Tdarr_Server +TimeoutStopSec=20 +KillMode=process +Restart=on-failure + +[Install] +WantedBy=multi-user.target" >$service_path + +service_path="/etc/systemd/system/tdarr-node.service" +echo "[Unit] +Description=Tdarr Node Daemon +After=network.target +Requires=tdarr-server.service + +[Service] +User=root +Group=root + +Type=simple +WorkingDirectory=/opt/tdarr/Tdarr_Node +ExecStart=/opt/tdarr/Tdarr_Node/Tdarr_Node +TimeoutStopSec=20 +KillMode=process +Restart=on-failure + +[Install] +WantedBy=multi-user.target" >$service_path +systemctl enable --now -q tdarr-server.service +systemctl enable --now -q tdarr-node.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf Tdarr_Updater.zip +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/technitiumdns-install.sh b/install/technitiumdns-install.sh new file mode 100644 index 00000000..12ea927d --- /dev/null +++ b/install/technitiumdns-install.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing ASP.NET Core Runtime" +wget -q https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb +$STD dpkg -i packages-microsoft-prod.deb +rm -rf packages-microsoft-prod.deb +$STD apt-get update +$STD apt-get install -y aspnetcore-runtime-8.0 +msg_ok "Installed ASP.NET Core Runtime" + +msg_info "Installing Technitium DNS" +$STD bash <(curl -fsSL https://download.technitium.com/dns/install.sh) +msg_ok "Installed Technitium DNS" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/threadfin-install.sh b/install/threadfin-install.sh new file mode 100644 index 00000000..5fb8211d --- /dev/null +++ b/install/threadfin-install.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 sudo +$STD apt-get install -y mc +$STD apt-get install -y curl +$STD apt-get install -y ffmpeg +$STD apt-get install -y vlc +msg_ok "Installed Dependencies" + +msg_info "Installing Threadfin" +mkdir -p /opt/threadfin +wget -q -O /opt/threadfin/threadfin 'https://github.com/Threadfin/Threadfin/releases/latest/download/Threadfin_linux_amd64' +chmod +x /opt/threadfin/threadfin + +msg_ok "Installed Threadfin" + +msg_info "Creating Service" +cat </etc/systemd/system/threadfin.service +[Unit] +Description=Threadfin: M3U Proxy for Plex DVR and Emby/Jellyfin Live TV +After=syslog.target network.target +[Service] +Type=simple +WorkingDirectory=/opt/threadfin +ExecStart=/opt/threadfin/threadfin +TimeoutStopSec=20 +KillMode=process +Restart=on-failure +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now threadfin.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/traccar-install.sh b/install/traccar-install.sh new file mode 100644 index 00000000..f68d365e --- /dev/null +++ b/install/traccar-install.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +RELEASE=$(curl -s https://api.github.com/repos/traccar/traccar/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +msg_info "Installing Traccar v${RELEASE}" +wget -q https://github.com/traccar/traccar/releases/download/v${RELEASE}/traccar-linux-64-${RELEASE}.zip +$STD unzip traccar-linux-64-${RELEASE}.zip +$STD ./traccar.run +systemctl enable -q --now traccar +rm -rf README.txt traccar-linux-64-${RELEASE}.zip traccar.run +msg_ok "Installed Traccar v${RELEASE}" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/traefik-install.sh b/install/traefik-install.sh new file mode 100644 index 00000000..7b5c44b3 --- /dev/null +++ b/install/traefik-install.sh @@ -0,0 +1,115 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gpg +$STD apt-get install -y apt-transport-https +msg_ok "Installed Dependencies" + +RELEASE=3.0.4 #$(curl -s https://api.github.com/repos/traefik/traefik/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +msg_info "Installing Traefik v${RELEASE}" +mkdir -p /etc/traefik/{conf.d,ssl} +wget -q https://github.com/traefik/traefik/releases/download/v${RELEASE}/traefik_v${RELEASE}_linux_amd64.tar.gz +tar -C /tmp -xzf traefik*.tar.gz +mv /tmp/traefik /usr/bin/ +rm -rf traefik*.tar.gz +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed Traefik v${RELEASE}" + +msg_info "Creating Traefik configuration" +cat </etc/traefik/traefik.yaml +providers: + file: + directory: /etc/traefik/conf.d/ + +entryPoints: + web: + address: ':80' + http: + redirections: + entryPoint: + to: websecure + scheme: https + websecure: + address: ':443' + http: + tls: + certResolver: letsencrypt + traefik: + address: ':8080' + +certificatesResolvers: + letsencrypt: + acme: + email: "foo@bar.com" + storage: /etc/traefik/ssl/acme.json + tlsChallenge: {} + +api: + dashboard: true + insecure: true + +log: + filePath: /var/log/traefik/traefik.log + format: json + level: INFO + +accessLog: + filePath: /var/log/traefik/traefik-access.log + format: json + filters: + statusCodes: + - "200" + - "400-599" + retryAttempts: true + minDuration: "10ms" + bufferingSize: 0 + fields: + headers: + defaultMode: drop + names: + User-Agent: keep +EOF +msg_ok "Created Traefik configuration" + +msg_info "Creating Service" +cat </etc/systemd/system/traefik.service +[Unit] +Description=Traefik is an open-source Edge Router that makes publishing your services a fun and easy experience + +[Service] +Type=notify +ExecStart=/usr/bin/traefik --configFile=/etc/traefik/traefik.yaml +Restart=on-failure +ExecReload=/bin/kill -USR1 \$MAINPID + +[Install] +WantedBy=multi-user.target +EOF + +systemctl enable -q --now traefik.service +msg_ok "Created Service" + + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/transmission-install.sh b/install/transmission-install.sh new file mode 100644 index 00000000..2550bb00 --- /dev/null +++ b/install/transmission-install.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + + +msg_info "Installing Transmission" +$STD apt-get install -y transmission-daemon +systemctl stop transmission-daemon +sed -i '{s/"rpc-whitelist-enabled": true/"rpc-whitelist-enabled": false/g; s/"rpc-host-whitelist-enabled": true,/"rpc-host-whitelist-enabled": false,/g}' /etc/transmission-daemon/settings.json +systemctl start transmission-daemon +msg_ok "Installed Transmission" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/trilium-install.sh b/install/trilium-install.sh new file mode 100644 index 00000000..6e7861a6 --- /dev/null +++ b/install/trilium-install.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +RELEASE=$(curl -s https://api.github.com/repos/zadam/trilium/releases/latest | + grep "tag_name" | + awk '{print substr($2, 3, length($2)-4) }') + +msg_info "Installing Trilium" +wget -q https://github.com/zadam/trilium/releases/download/v$RELEASE/trilium-linux-x64-server-$RELEASE.tar.xz +$STD tar -xvf trilium-linux-x64-server-$RELEASE.tar.xz +mv trilium-linux-x64-server /opt/trilium +msg_ok "Installed Trilium" + +msg_info "Creating Service" +service_path="/etc/systemd/system/trilium.service" + +echo "[Unit] +Description=Trilium Daemon +After=syslog.target network.target + +[Service] +User=root +Type=simple +ExecStart=/opt/trilium/trilium.sh +WorkingDirectory=/opt/trilium/ +TimeoutStopSec=20 +Restart=always + +[Install] +WantedBy=multi-user.target" >$service_path +systemctl enable --now -q trilium +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +rm -rf /root/trilium-linux-x64-server-$RELEASE.tar.xz +msg_ok "Cleaned" diff --git a/install/ubuntu-install.sh b/install/ubuntu-install.sh new file mode 100644 index 00000000..841dd3f3 --- /dev/null +++ b/install/ubuntu-install.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/umami-install.sh b/install/umami-install.sh new file mode 100644 index 00000000..8fd103b2 --- /dev/null +++ b/install/umami-install.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y gpg +$STD apt-get install -y postgresql +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +$STD npm install -g yarn +msg_ok "Installed Node.js" + +msg_info "Setting up postgresql" +DB_NAME=umamidb +DB_USER=umami +DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" +SECRET_KEY="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)" +$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" +$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" +echo "" >~/umami.creds +echo "Umami Database Credentials" >>~/umami.creds +echo "" >>~/umami.creds +echo -e "umami Database User: \e[32m$DB_USER\e[0m" >>~/umami.creds +echo -e "umami Database Password: \e[32m$DB_PASS\e[0m" >>~/umami.creds +echo -e "umami Database Name: \e[32m$DB_NAME\e[0m" >>~/umami.creds +msg_ok "Set up postgresql" + +msg_info "Installing Umami (Patience)" +git clone -q https://github.com/umami-software/umami.git /opt/umami +cd /opt/umami +$STD yarn install +echo -e "DATABASE_URL=postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME" >>/opt/umami/.env +$STD yarn run build +msg_ok "Installed Umami" + +msg_info "Creating Service" +cat </etc/systemd/system/umami.service +echo "[Unit] +Description=umami + +[Service] +Type=simple +Restart=always +User=root +WorkingDirectory=/opt/umami +ExecStart=/usr/bin/yarn run start + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now umami.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/umbrel-install.sh b/install/umbrel-install.sh new file mode 100644 index 00000000..f0411f49 --- /dev/null +++ b/install/umbrel-install.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Umbrel (Patience)" +DOCKER_CONFIG_PATH='/etc/docker/daemon.json' +mkdir -p $(dirname $DOCKER_CONFIG_PATH) +echo -e '{\n "log-driver": "journald"\n}' > /etc/docker/daemon.json +$STD bash <(curl -fsSL https://umbrel.sh) +systemctl daemon-reload +$STD systemctl enable --now umbrel-startup.service +msg_ok "Installed Umbrel" + +motd_ssh +customize + +msg_info "Cleaning up" +#$STD apt-get autoremove +#$STD apt-get autoclean +msg_ok "Cleaned" diff --git a/install/unifi-install.sh b/install/unifi-install.sh new file mode 100644 index 00000000..5341ee58 --- /dev/null +++ b/install/unifi-install.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y apt-transport-https +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Installing Eclipse Temurin JRE" +wget -qO- https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor >/etc/apt/trusted.gpg.d/adoptium.gpg +echo "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/adoptium.gpg] https://packages.adoptium.net/artifactory/deb bookworm main" >/etc/apt/sources.list.d/adoptium.list +$STD apt-get update +$STD apt-get install -y temurin-17-jre +msg_ok "Installed Eclipse Temurin JRE" + +msg_info "Installing MongoDB" +wget -qO- https://www.mongodb.org/static/pgp/server-7.0.asc | gpg --dearmor >/usr/share/keyrings/mongodb-server-7.0.gpg +echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" >/etc/apt/sources.list.d/mongodb-org-7.0.list +$STD apt-get update +$STD apt-get install -y mongodb-org +msg_ok "Installed MongoDB" + +msg_info "Installing UniFi Network Server" +wget -qO /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg +echo "deb [ arch=amd64 signed-by=/etc/apt/trusted.gpg.d/unifi-repo.gpg] https://www.ui.com/downloads/unifi/debian stable ubiquiti" >/etc/apt/sources.list.d/100-ubnt-unifi.list +$STD apt-get update +$STD apt-get install -y unifi +msg_ok "Installed UniFi Network Server" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/unmanic-install.sh b/install/unmanic-install.sh new file mode 100644 index 00000000..70b73dc8 --- /dev/null +++ b/install/unmanic-install.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get install -y curl +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y ffmpeg +$STD apt-get install -y python3-pip +msg_ok "Installed Dependencies" + +if [[ "$CTTYPE" == "0" ]]; then + msg_info "Setting Up Hardware Acceleration" + $STD apt-get -y install \ + va-driver-all \ + ocl-icd-libopencl1 \ + intel-opencl-icd + chgrp video /dev/dri + chmod 755 /dev/dri + chmod 660 /dev/dri/* + $STD adduser $(id -u -n) video + $STD adduser $(id -u -n) render + msg_ok "Set Up Hardware Acceleration" +fi + +msg_info "Installing Unmanic" +$STD pip3 install unmanic +sed -i -e 's/^sgx:x:104:$/render:x:104:root/' -e 's/^render:x:106:root$/sgx:x:106:/' /etc/group +msg_ok "Installed Unmanic" + +msg_info "Creating Service" +cat << EOF >/etc/systemd/system/unmanic.service +[Unit] +Description=Unmanic - Library Optimiser +After=network-online.target +StartLimitInterval=200 +StartLimitBurst=3 + +[Service] +Type=simple +ExecStart=/usr/local/bin/unmanic +Restart=always +RestartSec=30 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable --now -q unmanic.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/uptimekuma-install.sh b/install/uptimekuma-install.sh new file mode 100644 index 00000000..4a429191 --- /dev/null +++ b/install/uptimekuma-install.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y ca-certificates +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing Uptime Kuma" +$STD git clone https://github.com/louislam/uptime-kuma.git +mv uptime-kuma /opt/uptime-kuma +cd /opt/uptime-kuma +$STD npm run setup +msg_ok "Installed Uptime Kuma" + +msg_info "Creating Service" +service_path="/etc/systemd/system/uptime-kuma.service" +echo "[Unit] +Description=uptime-kuma + +[Service] +Type=simple +Restart=always +User=root +WorkingDirectory=/opt/uptime-kuma +ExecStart=/usr/bin/npm start + +[Install] +WantedBy=multi-user.target" >$service_path +$STD systemctl enable --now uptime-kuma.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/vaultwarden-install.sh b/install/vaultwarden-install.sh new file mode 100644 index 00000000..c76297e3 --- /dev/null +++ b/install/vaultwarden-install.sh @@ -0,0 +1,119 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 update +$STD apt-get -qqy install \ + git \ + build-essential \ + pkgconf \ + libssl-dev \ + libmariadb-dev-compat \ + libpq-dev \ + curl \ + sudo \ + argon2 \ + mc +msg_ok "Installed Dependencies" + +WEBVAULT=$(curl -s https://api.github.com/repos/dani-garcia/bw_web_builds/releases/latest | + grep "tag_name" | + awk '{print substr($2, 2, length($2)-3) }') + +VAULT=$(curl -s https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest | + grep "tag_name" | + awk '{print substr($2, 2, length($2)-3) }') + +msg_info "Installing Rust" +wget -qL https://sh.rustup.rs +$STD bash index.html -y --profile minimal +echo 'export PATH=~/.cargo/bin:$PATH' >>~/.bashrc +export PATH=~/.cargo/bin:$PATH +rm index.html +msg_ok "Installed Rust" + +msg_info "Building Vaultwarden ${VAULT} (Patience)" +$STD git clone https://github.com/dani-garcia/vaultwarden +cd vaultwarden +$STD cargo build --features "sqlite,mysql,postgresql" --release +msg_ok "Built Vaultwarden ${VAULT}" + +$STD addgroup --system vaultwarden +$STD adduser --system --home /opt/vaultwarden --shell /usr/sbin/nologin --no-create-home --gecos 'vaultwarden' --ingroup vaultwarden --disabled-login --disabled-password vaultwarden +mkdir -p /opt/vaultwarden/bin +mkdir -p /opt/vaultwarden/data +cp target/release/vaultwarden /opt/vaultwarden/bin/ + +msg_info "Downloading Web-Vault ${WEBVAULT}" +$STD curl -fsSLO https://github.com/dani-garcia/bw_web_builds/releases/download/$WEBVAULT/bw_web_$WEBVAULT.tar.gz +$STD tar -xzf bw_web_$WEBVAULT.tar.gz -C /opt/vaultwarden/ +msg_ok "Downloaded Web-Vault ${WEBVAULT}" + +cat </opt/vaultwarden/.env +ADMIN_TOKEN='' +ROCKET_ADDRESS=0.0.0.0 +DATA_FOLDER=/opt/vaultwarden/data +DATABASE_MAX_CONNS=10 +WEB_VAULT_FOLDER=/opt/vaultwarden/web-vault +WEB_VAULT_ENABLED=true +EOF + +msg_info "Creating Service" +chown -R vaultwarden:vaultwarden /opt/vaultwarden/ +chown root:root /opt/vaultwarden/bin/vaultwarden +chmod +x /opt/vaultwarden/bin/vaultwarden +chown -R root:root /opt/vaultwarden/web-vault/ +chmod +r /opt/vaultwarden/.env + +service_path="/etc/systemd/system/vaultwarden.service" +echo "[Unit] +Description=Bitwarden Server (Powered by Vaultwarden) +Documentation=https://github.com/dani-garcia/vaultwarden +After=network.target +[Service] +User=vaultwarden +Group=vaultwarden +EnvironmentFile=-/opt/vaultwarden/.env +ExecStart=/opt/vaultwarden/bin/vaultwarden +LimitNOFILE=65535 +LimitNPROC=4096 +PrivateTmp=true +PrivateDevices=true +ProtectHome=true +ProtectSystem=strict +DevicePolicy=closed +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +RestrictNamespaces=yes +RestrictRealtime=yes +MemoryDenyWriteExecute=yes +LockPersonality=yes +WorkingDirectory=/opt/vaultwarden +ReadWriteDirectories=/opt/vaultwarden/data +AmbientCapabilities=CAP_NET_BIND_SERVICE +[Install] +WantedBy=multi-user.target" >$service_path +systemctl daemon-reload +$STD systemctl enable --now vaultwarden.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/wastebin-install.sh b/install/wastebin-install.sh new file mode 100644 index 00000000..227b1095 --- /dev/null +++ b/install/wastebin-install.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +# Source: https://github.com/matze/wastebin + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies (Patience)" +$STD apt-get install -y --no-install-recommends \ + build-essential \ + unzip \ + curl \ + sudo \ + git \ + make \ + mc +msg_ok "Installed Dependencies" + +msg_info "Installing Rust (Patience)" +$STD bash <(curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs) -y +source ~/.cargo/env +msg_ok "Installed Rust" + +msg_info "Installing Wastebin (Patience)" +RELEASE=$(curl -s https://api.github.com/repos/matze/wastebin/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +wget -q "https://github.com/matze/wastebin/archive/refs/tags/${RELEASE}.zip" +unzip -q ${RELEASE}.zip +mv wastebin-${RELEASE} /opt/wastebin +rm -R ${RELEASE}.zip +cd /opt/wastebin +cargo build -q --release +msg_ok "Installed Wastebin" + +msg_info "Creating Service" +cat </etc/systemd/system/wastebin.service +[Unit] +Description=Start Wastebin Service +After=network.target + +[Service] +User=root +WorkingDirectory=/opt/wastebin +ExecStart=/root/.cargo/bin/cargo run --release --quiet + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now wastebin.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/watchyourlan-install.sh b/install/watchyourlan-install.sh new file mode 100644 index 00000000..c54342c5 --- /dev/null +++ b/install/watchyourlan-install.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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,sudo,mc,gpg,arp-scan,ieee-data,libwww-perl} +msg_ok "Installed Dependencies" + +msg_info "Installing WatchYourLAN" +RELEASE=$(curl -s https://api.github.com/repos/aceberg/WatchYourLAN/releases/latest | grep -o '"tag_name": *"[^"]*"' | cut -d '"' -f 4) +wget -q https://github.com/aceberg/WatchYourLAN/releases/download/$RELEASE/watchyourlan_${RELEASE}_linux_amd64.deb +$STD dpkg -i watchyourlan_${RELEASE}_linux_amd64.deb +rm watchyourlan_${RELEASE}_linux_amd64.deb +mkdir /data +cat </data/config.yaml +arp_timeout: "500" +auth: false +auth_expire: 7d +auth_password: "" +auth_user: "" +color: dark +dbpath: /data/db.sqlite +guiip: 0.0.0.0 +guiport: "8840" +history_days: "30" +iface: eth0 +ignoreip: "no" +loglevel: verbose +shoutrrr_url: "" +theme: solar +timeout: 60 +EOF +msg_ok "Installed WatchYourLAN" + +msg_info "Creating Service" +sed -i 's|/etc/watchyourlan/config.yaml|/data/config.yaml|' /lib/systemd/system/watchyourlan.service +systemctl enable -q --now watchyourlan.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/whisparr-install.sh b/install/whisparr-install.sh new file mode 100644 index 00000000..16d20893 --- /dev/null +++ b/install/whisparr-install.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y sqlite3 +msg_ok "Installed Dependencies" + +msg_info "Installing Whisparr" +mkdir -p /var/lib/whisparr/ +chmod 775 /var/lib/whisparr/ +$STD wget --content-disposition 'https://whisparr.servarr.com/v1/update/nightly/updatefile?os=linux&runtime=netcore&arch=x64' +$STD tar -xvzf Whisparr.develop.*.tar.gz +mv Whisparr /opt +chmod 775 /opt/Whisparr +msg_ok "Installed Whisparr" + +msg_info "Creating Service" +cat </etc/systemd/system/whisparr.service +[Unit] +Description=whisparr Daemon +After=syslog.target network.target +[Service] +UMask=0002 +Type=simple +ExecStart=/opt/Whisparr/Whisparr -nobrowser -data=/var/lib/whisparr/ +TimeoutStopSec=20 +KillMode=process +Restart=on-failure +[Install] +WantedBy=multi-user.target +EOF +systemctl -q daemon-reload +systemctl enable --now -q whisparr +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf Whisparr.develop.*.tar.gz +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/whoogle-install.sh b/install/whoogle-install.sh new file mode 100644 index 00000000..f3516d32 --- /dev/null +++ b/install/whoogle-install.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Updating Python3" +$STD apt-get install -y \ + python3 \ + python3-dev \ + python3-pip +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Updated Python3" + +msg_info "Installing Whoogle" +$STD pip install brotli +$STD pip install whoogle-search + +service_path="/etc/systemd/system/whoogle.service" +echo "[Unit] +Description=Whoogle-Search +After=network.target +[Service] +ExecStart=/usr/local/bin/whoogle-search --host 0.0.0.0 +Restart=always +User=root +[Install] +WantedBy=multi-user.target" >$service_path + +$STD systemctl enable --now whoogle.service +msg_ok "Installed Whoogle" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/wikijs-install.sh b/install/wikijs-install.sh new file mode 100644 index 00000000..fe95122e --- /dev/null +++ b/install/wikijs-install.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y ca-certificates +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing Wiki.js" +mkdir -p /opt/wikijs +cd /opt/wikijs +$STD wget https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz +tar xzf wiki-js.tar.gz +rm wiki-js.tar.gz + +cat </opt/wikijs/config.yml +bindIP: 0.0.0.0 +port: 3000 +db: + type: sqlite + storage: /opt/wikijs/db.sqlite +logLevel: info +logFormat: default +dataPath: /opt/wikijs/data +bodyParserLimit: 5mb +EOF +$STD npm rebuild sqlite3 +msg_ok "Installed Wiki.js" + +msg_info "Creating Service" +service_path="/etc/systemd/system/wikijs.service" + +echo "[Unit] +Description=Wiki.js +After=network.target + +[Service] +Type=simple +ExecStart=/usr/bin/node server +Restart=always +User=root +Environment=NODE_ENV=production +WorkingDirectory=/opt/wikijs + +[Install] +WantedBy=multi-user.target" >$service_path +$STD systemctl enable --now wikijs +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/wireguard-install.sh b/install/wireguard-install.sh new file mode 100644 index 00000000..7cd00403 --- /dev/null +++ b/install/wireguard-install.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y gunicorn +msg_ok "Installed Dependencies" + +msg_info "Installing WireGuard (using pivpn.io)" +OPTIONS_PATH='/options.conf' +cat >$OPTIONS_PATH </dev/null +sed -i "s/^DBName=.*/DBName=$DB_NAME/" /etc/zabbix/zabbix_server.conf +sed -i "s/^DBUser=.*/DBUser=$DB_USER/" /etc/zabbix/zabbix_server.conf +sed -i "s/^# DBPassword=.*/DBPassword=$DB_PASS/" /etc/zabbix/zabbix_server.conf +echo "" >~/zabbix.creds +echo "zabbix Database Credentials" >>~/zabbix.creds +echo "" >>~/zabbix.creds +echo -e "zabbix Database User: \e[32m$DB_USER\e[0m" >>~/zabbix.creds +echo -e "zabbix Database Password: \e[32m$DB_PASS\e[0m" >>~/zabbix.creds +echo -e "zabbix Database Name: \e[32m$DB_NAME\e[0m" >>~/zabbix.creds +msg_ok "Set up PostgreSQL" + +msg_info "Starting Services" +systemctl restart zabbix-server zabbix-agent apache2 +systemctl enable -q zabbix-server zabbix-agent apache2 +msg_ok "Started Services" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/zigbee2mqtt-install.sh b/install/zigbee2mqtt-install.sh new file mode 100644 index 00000000..55acdcbc --- /dev/null +++ b/install/zigbee2mqtt-install.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +$STD apt-get install -y make +$STD apt-get install -y g++ +$STD apt-get install -y gcc +$STD apt-get install -y ca-certificates +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Setting up Zigbee2MQTT Repository" +$STD git clone --depth 1 https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt +msg_ok "Set up Zigbee2MQTT Repository" + +read -r -p "Switch to Edge/dev branch? (y/N) " prompt +if [[ $prompt == "y" ]]; then + DEV="y" +else + DEV="n" +fi + +msg_info "Installing Zigbee2MQTT" +cd /opt/zigbee2mqtt +if [[ $DEV == "y" ]]; then +$STD git fetch origin dev:dev +$STD git checkout dev +$STD git pull +fi +$STD npm ci +msg_ok "Installed Zigbee2MQTT" + +msg_info "Creating Service" +service_path="/etc/systemd/system/zigbee2mqtt.service" +echo "[Unit] +Description=zigbee2mqtt +After=network.target +[Service] +Environment=NODE_ENV=production +ExecStart=/usr/bin/npm start +WorkingDirectory=/opt/zigbee2mqtt +StandardOutput=inherit +StandardError=inherit +Restart=always +User=root +[Install] +WantedBy=multi-user.target" >$service_path +$STD systemctl enable zigbee2mqtt.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/zoraxy-install.sh b/install/zoraxy-install.sh new file mode 100644 index 00000000..73787ed1 --- /dev/null +++ b/install/zoraxy-install.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y git +msg_ok "Installed Dependencies" + +msg_info "Installing Golang" +set +o pipefail +RELEASE=$(curl -s https://go.dev/dl/ | grep -o "go.*\linux-amd64.tar.gz" | head -n 1) +wget -q https://golang.org/dl/$RELEASE +$STD tar -xzf $RELEASE -C /usr/local +$STD ln -s /usr/local/go/bin/go /usr/local/bin/go +set -o pipefail +msg_ok "Installed Golang" + +msg_info "Installing Zoraxy (Patience)" +$STD git clone https://github.com/tobychui/zoraxy /opt/zoraxy +cd /opt/zoraxy/src +$STD go mod tidy +$STD go build +msg_ok "Installed Zoraxy" + +msg_info "Creating Service" +cat </etc/systemd/system/zoraxy.service +[Unit] +Description=General purpose request proxy and forwarding tool +After=syslog.target network-online.target + +[Service] +ExecStart=/opt/zoraxy/src/./zoraxy +WorkingDirectory=/opt/zoraxy/src/ +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now zoraxy.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf $RELEASE +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/install/zwave-js-ui-install.sh b/install/zwave-js-ui-install.sh new file mode 100644 index 00000000..c1966ed4 --- /dev/null +++ b/install/zwave-js-ui-install.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +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 +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Z-Wave JS UI" +mkdir /opt/zwave-js-ui +cd /opt/zwave-js-ui +RELEASE=$(curl -s https://api.github.com/repos/zwave-js/zwave-js-ui/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +$STD wget https://github.com/zwave-js/zwave-js-ui/releases/download/${RELEASE}/zwave-js-ui-${RELEASE}-linux.zip +$STD unzip zwave-js-ui-${RELEASE}-linux.zip +msg_ok "Installed Z-Wave JS UI" + +msg_info "Creating Service" +service_path="/etc/systemd/system/zwave-js-ui.service" +echo "[Unit] +Description=zwave-js-ui +Wants=network-online.target +After=network-online.target +[Service] +User=root +WorkingDirectory=/opt/zwave-js-ui +ExecStart=/opt/zwave-js-ui/zwave-js-ui-linux +[Install] +WantedBy=multi-user.target" >$service_path +systemctl start zwave-js-ui +$STD systemctl enable zwave-js-ui +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm zwave-js-ui-${RELEASE}-linux.zip +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/misc/add-netbird-lxc.sh b/misc/add-netbird-lxc.sh new file mode 100644 index 00000000..05427106 --- /dev/null +++ b/misc/add-netbird-lxc.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _ __ __ ____ _ __ + / | / /__ / /_/ __ )(_)________/ / + / |/ / _ \/ __/ __ / / ___/ __ / + / /| / __/ /_/ /_/ / / / / /_/ / +/_/ |_/\___/\__/_____/_/_/ \__,_/ + +EOF +} +header_info +set -e +while true; do + read -p "This will add NetBird to an existing LXC Container ONLY. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +header_info +echo "Loading..." +function msg() { + local TEXT="$1" + echo -e "$TEXT" +} + +NODE=$(hostname) +MSG_MAX_LENGTH=0 +while read -r line; do + TAG=$(echo "$line" | awk '{print $1}') + ITEM=$(echo "$line" | awk '{print substr($0,36)}') + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + CTID_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') + +while [ -z "${CTID:+x}" ]; do + CTID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Containers on $NODE" --radiolist \ + "\nSelect a container to add NetBird to:\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done + +CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf +cat <>$CTID_CONFIG_PATH +lxc.cgroup2.devices.allow: c 10:200 rwm +lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file +EOF +header_info +msg "Installing NetBird..." +pct exec "$CTID" -- bash -c ' +apt install -y ca-certificates gpg &>/dev/null +wget -qO- https://pkgs.netbird.io/debian/public.key | gpg --dearmor >/usr/share/keyrings/netbird-archive-keyring.gpg +echo "deb [signed-by=/usr/share/keyrings/netbird-archive-keyring.gpg] https://pkgs.netbird.io/debian stable main" >/etc/apt/sources.list.d/netbird.list +apt-get update &>/dev/null +apt-get install -y netbird-ui &>/dev/null +' || exit +msg "\e[1;32m ✔ Installed NetBird.\e[0m" +sleep 2 +msg "\e[1;31m Reboot ${CTID} LXC to apply the changes, then run netbird up in the LXC console\e[0m" diff --git a/misc/add-tailscale-lxc.sh b/misc/add-tailscale-lxc.sh new file mode 100644 index 00000000..13307333 --- /dev/null +++ b/misc/add-tailscale-lxc.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ _ __ __ + /_ __/___ _(_) /_____________ _/ /__ + / / / __ `/ / / ___/ ___/ __ `/ / _ \ + / / / /_/ / / (__ ) /__/ /_/ / / __/ +/_/ \__,_/_/_/____/\___/\__,_/_/\___/ + +EOF +} +header_info +set -e +while true; do + read -p "This will add Tailscale to an existing LXC Container ONLY. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +header_info +echo "Loading..." +function msg() { + local TEXT="$1" + echo -e "$TEXT" +} + +NODE=$(hostname) +MSG_MAX_LENGTH=0 +while read -r line; do + TAG=$(echo "$line" | awk '{print $1}') + ITEM=$(echo "$line" | awk '{print substr($0,36)}') + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + CTID_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') + +while [ -z "${CTID:+x}" ]; do + CTID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Containers on $NODE" --radiolist \ + "\nSelect a container to add Tailscale to:\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done + +CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf +cat <>$CTID_CONFIG_PATH +lxc.cgroup2.devices.allow: c 10:200 rwm +lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file +EOF +header_info +msg "Installing Tailscale..." +pct exec "$CTID" -- bash -c ' +ID=$(grep "^ID=" /etc/os-release | cut -d"=" -f2) +VER=$(grep "^VERSION_CODENAME=" /etc/os-release | cut -d"=" -f2) +wget -qO- https://pkgs.tailscale.com/stable/$ID/$VER.noarmor.gpg >/usr/share/keyrings/tailscale-archive-keyring.gpg +echo "deb [signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/$ID $VER main" >/etc/apt/sources.list.d/tailscale.list +apt-get update &>/dev/null +apt-get install -y tailscale &>/dev/null +' || exit +msg "\e[1;32m ✔ Installed Tailscale\e[0m" + +msg "\e[1;31m Reboot ${CTID} LXC to apply the changes, then run tailscale up in the LXC console\e[0m" diff --git a/misc/all-templates.sh b/misc/all-templates.sh new file mode 100644 index 00000000..ab430e7c --- /dev/null +++ b/misc/all-templates.sh @@ -0,0 +1,209 @@ +#!/usr/bin/env bash +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + ___ ____ ______ __ __ + / _ | / / / /_ __/__ __ _ ___ / /__ _/ /____ ___ + / __ |/ / / / / / -_) ' \/ _ \/ / _ `/ __/ -_|_-< +/_/ |_/_/_/ /_/ \__/_/_/_/ .__/_/\_,_/\__/\__/___/ + /_/ +EOF +} + +set -eEuo pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +function error_exit() { + trap - ERR + local DEFAULT='Unknown failure occured.' + local REASON="\e[97m${1:-$DEFAULT}\e[39m" + local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" + msg "$FLAG $REASON" 1>&2 + [ ! -z ${CTID-} ] && cleanup_ctid + exit $EXIT +} +function warn() { + local REASON="\e[97m$1\e[39m" + local FLAG="\e[93m[WARNING]\e[39m" + msg "$FLAG $REASON" +} +function info() { + local REASON="$1" + local FLAG="\e[36m[INFO]\e[39m" + msg "$FLAG $REASON" +} +function msg() { + local TEXT="$1" + echo -e "$TEXT" +} +function cleanup_ctid() { + if pct status $CTID &>/dev/null; then + if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then + pct stop $CTID + fi + pct destroy $CTID + fi +} + +# Stop Proxmox VE Monitor-All if running +if systemctl is-active -q ping-instances.service; then + systemctl stop ping-instances.service +fi +header_info +echo "Loading..." +pveam update >/dev/null 2>&1 +whiptail --backtitle "Proxmox VE Helper Scripts" --title "All Templates" --yesno "This will allow for the creation of one of the many Template LXC Containers. Proceed?" 10 68 || exit +TEMPLATE_MENU=() +MSG_MAX_LENGTH=0 +while read -r TAG ITEM; do + OFFSET=2 + ((${#ITEM} + OFFSET > MSG_MAX_LENGTH)) && MSG_MAX_LENGTH=${#ITEM}+OFFSET + TEMPLATE_MENU+=("$ITEM" "$TAG " "OFF") +done < <(pveam available) +TEMPLATE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "All Template LXCs" --radiolist "\nSelect a Template LXC to create:\n" 16 $((MSG_MAX_LENGTH + 58)) 10 "${TEMPLATE_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit +[ -z "$TEMPLATE" ] && { + whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Template LXC Selected" --msgbox "It appears that no Template LXC container was selected" 10 68 + msg "Done" + exit +} + +# Setup script environment +NAME=$(echo "$TEMPLATE" | grep -oE '^[^-]+-[^-]+') +PASS="$(openssl rand -base64 8)" +CTID=$(pvesh get /cluster/nextid) +PCT_OPTIONS=" + -features keyctl=1,nesting=1 + -hostname $NAME + -tags proxmox-helper-scripts + -onboot 0 + -cores 2 + -memory 2048 + -password $PASS + -net0 name=eth0,bridge=vmbr0,ip=dhcp + -unprivileged 1 + " +DEFAULT_PCT_OPTIONS=( + -arch $(dpkg --print-architecture) +) + +# Set the CONTENT and CONTENT_LABEL variables +function select_storage() { + local CLASS=$1 + local CONTENT + local CONTENT_LABEL + case $CLASS in + container) + CONTENT='rootdir' + CONTENT_LABEL='Container' + ;; + template) + CONTENT='vztmpl' + CONTENT_LABEL='Container template' + ;; + *) false || die "Invalid storage class." ;; + esac + + # Query all storage locations + local -a MENU + while read -r line; do + local TAG=$(echo $line | awk '{print $1}') + local TYPE=$(echo $line | awk '{printf "%-10s", $2}') + local FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') + local ITEM=" Type: $TYPE Free: $FREE " + local OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + local MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + MENU+=("$TAG" "$ITEM" "OFF") + done < <(pvesm status -content $CONTENT | awk 'NR>1') + + # Select storage location + if [ $((${#MENU[@]} / 3)) -eq 0 ]; then + warn "'$CONTENT_LABEL' needs to be selected for at least one storage location." + die "Unable to detect valid storage location." + elif [ $((${#MENU[@]} / 3)) -eq 1 ]; then + printf ${MENU[0]} + else + local STORAGE + while [ -z "${STORAGE:+x}" ]; do + STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \ + "Which storage pool you would like to use for the ${CONTENT_LABEL,,}?\n\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${MENU[@]}" 3>&1 1>&2 2>&3) || die "Menu aborted." + done + printf $STORAGE + fi +} +header_info +# Get template storage +TEMPLATE_STORAGE=$(select_storage template) || exit +info "Using '$TEMPLATE_STORAGE' for template storage." + +# Get container storage +CONTAINER_STORAGE=$(select_storage container) || exit +info "Using '$CONTAINER_STORAGE' for container storage." + +# Download template +msg "Downloading LXC template (Patience)..." +pveam download $TEMPLATE_STORAGE $TEMPLATE >/dev/null || die "A problem occured while downloading the LXC template." + +# Create variable for 'pct' options +PCT_OPTIONS=(${PCT_OPTIONS[@]:-${DEFAULT_PCT_OPTIONS[@]}}) +[[ " ${PCT_OPTIONS[@]} " =~ " -rootfs " ]] || PCT_OPTIONS+=(-rootfs $CONTAINER_STORAGE:${PCT_DISK_SIZE:-8}) + +# Create LXC +msg "Creating LXC container..." +pct create $CTID ${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE} ${PCT_OPTIONS[@]} >/dev/null || + die "A problem occured while trying to create container." + +# Save password +echo "$NAME password: ${PASS}" >>~/$NAME.creds # file is located in the Proxmox root directory + +# Start container +msg "Starting LXC Container..." +pct start "$CTID" +sleep 5 + +# Get container IP +set +eEuo pipefail +max_attempts=5 +attempt=1 +IP="" +while [[ $attempt -le $max_attempts ]]; do + IP=$(pct exec $CTID ip a show dev eth0 | grep -oP 'inet \K[^/]+') + if [[ -n $IP ]]; then + break + else + warn "Attempt $attempt: IP address not found. Pausing for 5 seconds..." + sleep 5 + ((attempt++)) + fi +done + +if [[ -z $IP ]]; then + warn "Maximum number of attempts reached. IP address not found." + IP="NOT FOUND" +fi + +set -eEuo pipefail +# Start Proxmox VE Monitor-All if available +if [[ -f /etc/systemd/system/ping-instances.service ]]; then + systemctl start ping-instances.service +fi + +# Success message +header_info +echo +info "LXC container '$CTID' was successfully created, and its IP address is ${IP}." +echo +info "Proceed to the LXC console to complete the setup." +echo +info "login: root" +info "password: $PASS" +echo diff --git a/misc/alpine-install.func b/misc/alpine-install.func new file mode 100644 index 00000000..3820d637 --- /dev/null +++ b/misc/alpine-install.func @@ -0,0 +1,120 @@ +color() { + YW=$(echo "\033[33m") + BL=$(echo "\033[36m") + RD=$(echo "\033[01;31m") + BGN=$(echo "\033[4;92m") + GN=$(echo "\033[1;92m") + DGN=$(echo "\033[32m") + CL=$(echo "\033[m") + RETRY_NUM=10 + RETRY_EVERY=3 + i=$RETRY_NUM + CM="${GN}✓${CL}" + CROSS="${RD}✗${CL}" + BFR="\\r\\033[K" + HOLD="-" +} + +verb_ip6() { + if [ "$VERBOSE" = "yes" ]; then + STD="" + else STD="silent"; fi + silent() { "$@" >/dev/null 2>&1; } + if [ "$DISABLEIPV6" == "yes" ]; then + $STD sysctl -w net.ipv6.conf.all.disable_ipv6=1 + echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf + $STD rc-update add sysctl default + fi +} + +catch_errors() { + set -Eeuo pipefail + trap 'error_handler $LINENO "$BASH_COMMAND"' ERR +} + +error_handler() { + local exit_code="$?" + local line_number="$1" + local command="$2" + local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" + echo -e "\n$error_message\n" +} + +msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +setting_up_container() { + msg_info "Setting up Container OS" + while [ $i -gt 0 ]; do + if [ "$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d'/' -f1)" != "" ]; then + break + fi + echo 1>&2 -en "${CROSS}${RD} No Network! " + sleep $RETRY_EVERY + i=$((i - 1)) + done + + if [ "$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d'/' -f1)" = "" ]; then + echo 1>&2 -e "\n${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}" + echo -e " 🖧 Check Network Settings" + exit 1 + fi + msg_ok "Set up Container OS" + msg_ok "Network Connected: ${BL}$(ip addr show | grep 'inet ' | awk '{print $2}' | cut -d'/' -f1 | tail -n1)${CL}" +} + +network_check() { + set +e + trap - ERR + if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then msg_ok "Internet Connected"; else + msg_error "Internet NOT Connected" + read -r -p "Would you like to continue anyway? " prompt + if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + echo -e " ⚠️ ${RD}Expect Issues Without Internet${CL}" + else + echo -e " 🖧 Check Network Settings" + exit 1 + fi + fi + RESOLVEDIP=$(getent hosts github.com | awk '{ print $1 }') + if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved github.com to ${BL}$RESOLVEDIP${CL}"; fi + set -e + trap 'error_handler $LINENO "$BASH_COMMAND"' ERR +} + +update_os() { + msg_info "Updating Container OS" + $STD apk update + $STD apk upgrade + msg_ok "Updated Container OS" +} + +motd_ssh() { + echo "export TERM='xterm-256color'" >>/root/.bashrc + echo -e "$APPLICATION LXC provided by https://tteck.github.io/Proxmox/\n" >/etc/motd + if [[ "${SSH_ROOT}" == "yes" ]]; then + $STD rc-update add sshd + sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config + $STD /etc/init.d/sshd start + fi +} + +customize() { + if [[ "$PASSWORD" == "" ]]; then + msg_info "Customizing Container" + bash -c "passwd -d root" >/dev/null 2>&1 + msg_ok "Customized Container" + fi +} diff --git a/misc/build.func b/misc/build.func new file mode 100644 index 00000000..b650a6c0 --- /dev/null +++ b/misc/build.func @@ -0,0 +1,652 @@ +variables() { + NSAPP=$(echo ${APP,,} | tr -d ' ') # This function sets the NSAPP variable by converting the value of the APP variable to lowercase and removing any spaces. + var_install="${NSAPP}-install" # sets the var_install variable by appending "-install" to the value of NSAPP. + INTEGER='^[0-9]+([.][0-9]+)?$' # it defines the INTEGER regular expression pattern. +} + +# This function sets various color variables using ANSI escape codes for formatting text in the terminal. +color() { + YW=$(echo "\033[33m") + BL=$(echo "\033[36m") + RD=$(echo "\033[01;31m") + BGN=$(echo "\033[4;92m") + GN=$(echo "\033[1;92m") + DGN=$(echo "\033[32m") + CL=$(echo "\033[m") + CM="${GN}✓${CL}" + CROSS="${RD}✗${CL}" + BFR="\\r\\033[K" + HOLD=" " +} + +# This function enables error handling in the script by setting options and defining a trap for the ERR signal. +catch_errors() { + set -Eeuo pipefail + trap 'error_handler $LINENO "$BASH_COMMAND"' ERR +} + +# This function is called when an error occurs. It receives the exit code, line number, and command that caused the error, and displays an error message. +error_handler() { + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + printf "\e[?25h" + local exit_code="$?" + local line_number="$1" + local command="$2" + local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" + echo -e "\n$error_message\n" +} + +# This function displays a spinner. +spinner() { + local chars="/-\|" + local spin_i=0 + printf "\e[?25l" + while true; do + printf "\r \e[36m%s\e[0m" "${chars:spin_i++%${#chars}:1}" + sleep 0.1 + done +} + +# This function displays an informational message with a yellow color. +msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg} " + spinner & + SPINNER_PID=$! +} + +# This function displays a success message with a green color. +msg_ok() { + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + printf "\e[?25h" + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +# This function displays a error message with a red color. +msg_error() { + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + printf "\e[?25h" + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +# Check if the shell is using bash +shell_check() { + if [[ "$(basename "$SHELL")" != "bash" ]]; then + clear + msg_error "Your default shell is currently not set to Bash. To use these scripts, please switch to the Bash shell." + echo -e "\nExiting..." + sleep 2 + exit + fi +} + +# Run as root only +root_check() { + if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then + clear + msg_error "Please run this script as root." + echo -e "\nExiting..." + sleep 2 + exit + fi +} + +# This function checks the version of Proxmox Virtual Environment (PVE) and exits if the version is not supported. +pve_check() { + if ! pveversion | grep -Eq "pve-manager/8.[1-3]"; then + msg_error "This version of Proxmox Virtual Environment is not supported" + echo -e "Requires Proxmox Virtual Environment Version 8.1 or later." + echo -e "Exiting..." + sleep 2 + exit +fi +} + +# This function checks the system architecture and exits if it's not "amd64". +arch_check() { + if [ "$(dpkg --print-architecture)" != "amd64" ]; then + echo -e "\n ${CROSS} This script will not work with PiMox! \n" + echo -e "\n Visit https://github.com/asylumexp/Proxmox for ARM64 support. \n" + echo -e "Exiting..." + sleep 2 + exit + fi +} + +# This function checks if the script is running through SSH and prompts the user to confirm if they want to proceed or exit. +ssh_check() { + if command -v pveversion >/dev/null 2>&1 && [ -n "${SSH_CLIENT:+x}" ]; then + if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "SSH DETECTED" --yesno "It's advisable to utilize the Proxmox shell rather than SSH, as there may be potential complications with variable retrieval. Proceed using SSH?" 10 72; then + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Proceed using SSH" "You've chosen to proceed using SSH. If any issues arise, please run the script in the Proxmox shell before creating a repository issue." 10 72 + else + clear + echo "Exiting due to SSH usage. Please consider using the Proxmox shell." + exit + fi + fi +} + +# This function displays the default values for various settings. +echo_default() { + echo -e "${DGN}Using Distribution: ${BGN}$var_os${CL}" + echo -e "${DGN}Using $var_os Version: ${BGN}$var_version${CL}" + echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" + echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" + echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}" + echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}" + echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}" + echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}" + echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}" + echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}" + echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}" + echo -e "${DGN}Using Gateway IP Address: ${BGN}Default${CL}" + echo -e "${DGN}Using Apt-Cacher IP Address: ${BGN}Default${CL}" + echo -e "${DGN}Disable IPv6: ${BGN}No${CL}" + echo -e "${DGN}Using Interface MTU Size: ${BGN}Default${CL}" + echo -e "${DGN}Using DNS Search Domain: ${BGN}Host${CL}" + echo -e "${DGN}Using DNS Server Address: ${BGN}Host${CL}" + echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}" + echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}" + echo -e "${DGN}Enable Root SSH Access: ${BGN}No${CL}" + echo -e "${DGN}Enable Verbose Mode: ${BGN}No${CL}" + echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" +} + +# This function is called when the user decides to exit the script. It clears the screen and displays an exit message. +exit-script() { + clear + echo -e "⚠ User exited script \n" + exit +} + +# This function allows the user to configure advanced settings for the script. +advanced_settings() { + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Here is an instructional tip:" "To make a selection, use the Spacebar." 8 58 + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Default distribution for $APP" "${var_os} ${var_version} \n \nIf the default Linux distribution is not adhered to, script support will be discontinued. \n" 10 58 + if [ "$var_os" != "alpine" ]; then + var_os="" + while [ -z "$var_os" ]; do + if var_os=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DISTRIBUTION" --radiolist "Choose Distribution:" 10 58 2 \ + "debian" "" OFF \ + "ubuntu" "" OFF \ + 3>&1 1>&2 2>&3); then + if [ -n "$var_os" ]; then + echo -e "${DGN}Using Distribution: ${BGN}$var_os${CL}" + fi + else + exit-script + fi + done + fi + + if [ "$var_os" == "debian" ]; then + var_version="" + while [ -z "$var_version" ]; do + if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DEBIAN VERSION" --radiolist "Choose Version" 10 58 2 \ + "11" "Bullseye" OFF \ + "12" "Bookworm" OFF \ + 3>&1 1>&2 2>&3); then + if [ -n "$var_version" ]; then + echo -e "${DGN}Using $var_os Version: ${BGN}$var_version${CL}" + fi + else + exit-script + fi + done + fi + + if [ "$var_os" == "ubuntu" ]; then + var_version="" + while [ -z "$var_version" ]; do + if var_version=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 3 \ + "20.04" "Focal" OFF \ + "22.04" "Jammy" OFF \ + "24.04" "Noble" OFF \ + 3>&1 1>&2 2>&3); then + if [ -n "$var_version" ]; then + echo -e "${DGN}Using $var_os Version: ${BGN}$var_version${CL}" + fi + else + exit-script + fi + done + fi + + CT_TYPE="" + while [ -z "$CT_TYPE" ]; do + if CT_TYPE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CONTAINER TYPE" --radiolist "Choose Type" 10 58 2 \ + "1" "Unprivileged" OFF \ + "0" "Privileged" OFF \ + 3>&1 1>&2 2>&3); then + if [ -n "$CT_TYPE" ]; then + echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" + fi + else + exit-script + fi + done + + while true; do + if PW1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --passwordbox "\nSet Root Password (needed for root ssh access)" 9 58 --title "PASSWORD (leave blank for automatic login)" 3>&1 1>&2 2>&3); then + if [[ ! -z "$PW1" ]]; then + if [[ "$PW1" == *" "* ]]; then + whiptail --msgbox "Password cannot contain spaces. Please try again." 8 58 + elif [ ${#PW1} -lt 5 ]; then + whiptail --msgbox "Password must be at least 5 characters long. Please try again." 8 58 + else + if PW2=$(whiptail --backtitle "Proxmox VE Helper Scripts" --passwordbox "\nVerify Root Password" 9 58 --title "PASSWORD VERIFICATION" 3>&1 1>&2 2>&3); then + if [[ "$PW1" == "$PW2" ]]; then + PW="-password $PW1" + echo -e "${DGN}Using Root Password: ${BGN}********${CL}" + break + else + whiptail --msgbox "Passwords do not match. Please try again." 8 58 + fi + else + exit-script + fi + fi + else + PW1="Automatic Login" + PW="" + echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" + break + fi + else + exit-script + fi + done + + + if CT_ID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 3>&1 1>&2 2>&3); then + if [ -z "$CT_ID" ]; then + CT_ID="$NEXTID" + echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" + else + echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}" + fi + else + exit + fi + + if CT_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3); then + if [ -z "$CT_NAME" ]; then + HN="$NSAPP" + else + HN=$(echo ${CT_NAME,,} | tr -d ' ') + fi + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + else + exit-script + fi + + if DISK_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 3>&1 1>&2 2>&3); then + if [ -z "$DISK_SIZE" ]; then + DISK_SIZE="$var_disk" + echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" + else + if ! [[ $DISK_SIZE =~ $INTEGER ]]; then + echo -e "${RD}⚠ DISK SIZE MUST BE AN INTEGER NUMBER!${CL}" + advanced_settings + fi + echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" + fi + else + exit-script + fi + + if CORE_COUNT=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 3>&1 1>&2 2>&3); then + if [ -z "$CORE_COUNT" ]; then + CORE_COUNT="$var_cpu" + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + else + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + fi + else + exit-script + fi + + if RAM_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3); then + if [ -z "$RAM_SIZE" ]; then + RAM_SIZE="$var_ram" + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + else + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + fi + else + exit-script + fi + + if BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3); then + if [ -z "$BRG" ]; then + BRG="vmbr0" + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + else + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + fi + else + exit-script + fi + + while true; do + NET=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Static IPv4 CIDR Address (/24)" 8 58 dhcp --title "IP ADDRESS" 3>&1 1>&2 2>&3) + exit_status=$? + if [ $exit_status -eq 0 ]; then + if [ "$NET" = "dhcp" ]; then + echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" + break + else + if [[ "$NET" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}/([0-9]|[1-2][0-9]|3[0-2])$ ]]; then + echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" + break + else + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox "$NET is an invalid IPv4 CIDR address. Please enter a valid IPv4 CIDR address or 'dhcp'" 8 58 + fi + fi + else + exit-script + fi + done + + if [ "$NET" != "dhcp" ]; then + while true; do + GATE1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Enter gateway IP address" 8 58 --title "Gateway IP" 3>&1 1>&2 2>&3) + if [ -z "$GATE1" ]; then + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox "Gateway IP address cannot be empty" 8 58 + elif [[ ! "$GATE1" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox "Invalid IP address format" 8 58 + else + GATE=",gw=$GATE1" + echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" + break + fi + done + else + GATE="" + echo -e "${DGN}Using Gateway IP Address: ${BGN}Default${CL}" + fi + + if [ "$var_os" == "alpine" ]; then + APT_CACHER="" + APT_CACHER_IP="" + else + if APT_CACHER_IP=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set APT-Cacher IP (leave blank for default)" 8 58 --title "APT-Cacher IP" 3>&1 1>&2 2>&3); then + APT_CACHER="${APT_CACHER_IP:+yes}" + echo -e "${DGN}Using APT-Cacher IP Address: ${BGN}${APT_CACHER_IP:-Default}${CL}" + else + exit-script + fi + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "IPv6" --yesno "Disable IPv6?" 10 58); then + DISABLEIP6="yes" + else + DISABLEIP6="no" + fi + echo -e "${DGN}Disable IPv6: ${BGN}$DISABLEIP6${CL}" + + if MTU1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Interface MTU Size (leave blank for default)" 8 58 --title "MTU SIZE" 3>&1 1>&2 2>&3); then + if [ -z $MTU1 ]; then + MTU1="Default" + MTU="" + else + MTU=",mtu=$MTU1" + fi + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + else + exit-script + fi + + if SD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a DNS Search Domain (leave blank for HOST)" 8 58 --title "DNS Search Domain" 3>&1 1>&2 2>&3); then + if [ -z $SD ]; then + SX=Host + SD="" + else + SX=$SD + SD="-searchdomain=$SD" + fi + echo -e "${DGN}Using DNS Search Domain: ${BGN}$SX${CL}" + else + exit-script + fi + + if NX=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a DNS Server IP (leave blank for HOST)" 8 58 --title "DNS SERVER IP" 3>&1 1>&2 2>&3); then + if [ -z $NX ]; then + NX=Host + NS="" + else + NS="-nameserver=$NX" + fi + echo -e "${DGN}Using DNS Server IP Address: ${BGN}$NX${CL}" + else + exit-script + fi + + if MAC1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 3>&1 1>&2 2>&3); then + if [ -z $MAC1 ]; then + MAC1="Default" + MAC="" + else + MAC=",hwaddr=$MAC1" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + fi + else + exit-script + fi + + if VLAN1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 3>&1 1>&2 2>&3); then + if [ -z $VLAN1 ]; then + VLAN1="Default" + VLAN="" + else + VLAN=",tag=$VLAN1" + fi + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + else + exit-script + fi + + if [[ "$PW" == -password* ]]; then + if (whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "SSH ACCESS" --yesno "Enable Root SSH Access?" 10 58); then + SSH="yes" + else + SSH="no" + fi + echo -e "${DGN}Enable Root SSH Access: ${BGN}$SSH${CL}" + else + SSH="no" + echo -e "${DGN}Enable Root SSH Access: ${BGN}$SSH${CL}" + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then + VERB="yes" + else + VERB="no" + fi + echo -e "${DGN}Enable Verbose Mode: ${BGN}$VERB${CL}" + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 10 58); then + echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}" + else + clear + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +install_script() { + pve_check + shell_check + root_check + arch_check + ssh_check + + if systemctl is-active -q ping-instances.service; then + systemctl -q stop ping-instances.service + fi + NEXTID=$(pvesh get /cluster/nextid) + timezone=$(cat /etc/timezone) + header_info + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +start() { + if command -v pveversion >/dev/null 2>&1; then + if ! (whiptail --backtitle "Proxmox VE Helper Scripts" --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then + clear + echo -e "⚠ User exited script \n" + exit + fi + SPINNER_PID="" + install_script + fi + + if ! command -v pveversion >/dev/null 2>&1; then + if ! (whiptail --backtitle "Proxmox VE Helper Scripts" --title "${APP} LXC UPDATE" --yesno "Support/Update functions for ${APP} LXC. Proceed?" 10 58); then + clear + echo -e "⚠ User exited script \n" + exit + fi + SPINNER_PID="" + update_script + fi +} + +# This function collects user settings and integrates all the collected information. +build_container() { +# if [ "$VERB" == "yes" ]; then set -x; fi + + if [ "$CT_TYPE" == "1" ]; then + FEATURES="keyctl=1,nesting=1" + else + FEATURES="nesting=1" + fi + + + TEMP_DIR=$(mktemp -d) + pushd $TEMP_DIR >/dev/null + if [ "$var_os" == "alpine" ]; then + export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/alpine-install.func)" + else + export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/install.func)" + fi + export CACHER="$APT_CACHER" + export CACHER_IP="$APT_CACHER_IP" + export tz="$timezone" + export DISABLEIPV6="$DISABLEIP6" + export APPLICATION="$APP" + export app="$NSAPP" + export PASSWORD="$PW" + export VERBOSE="$VERB" + export SSH_ROOT="${SSH}" + export CTID="$CT_ID" + export CTTYPE="$CT_TYPE" + export PCT_OSTYPE="$var_os" + export PCT_OSVERSION="$var_version" + export PCT_DISK_SIZE="$DISK_SIZE" + export PCT_OPTIONS=" + -features $FEATURES + -hostname $HN + -tags proxmox-helper-scripts + $SD + $NS + -net0 name=eth0,bridge=$BRG$MAC,ip=$NET$GATE$VLAN$MTU + -onboot 1 + -cores $CORE_COUNT + -memory $RAM_SIZE + -unprivileged $CT_TYPE + $PW + " + # This executes create_lxc.sh and creates the container and .conf file + bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit + + LXC_CONFIG=/etc/pve/lxc/${CTID}.conf + if [ "$CT_TYPE" == "0" ]; then + cat <>$LXC_CONFIG +# USB passthrough +lxc.cgroup2.devices.allow: a +lxc.cap.drop: +lxc.cgroup2.devices.allow: c 188:* rwm +lxc.cgroup2.devices.allow: c 189:* rwm +lxc.mount.entry: /dev/serial/by-id dev/serial/by-id none bind,optional,create=dir +lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file +lxc.mount.entry: /dev/ttyUSB1 dev/ttyUSB1 none bind,optional,create=file +lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=file +lxc.mount.entry: /dev/ttyACM1 dev/ttyACM1 none bind,optional,create=file +EOF + fi + + if [ "$CT_TYPE" == "0" ]; then + if [[ "$APP" == "Channels" || "$APP" == "Emby" || "$APP" == "Frigate" || "$APP" == "Jellyfin" || "$APP" == "Plex" || "$APP" == "Scrypted" || "$APP" == "Tdarr" || "$APP" == "Unmanic" ]]; then + cat <>$LXC_CONFIG +# VAAPI hardware transcoding +lxc.cgroup2.devices.allow: c 226:0 rwm +lxc.cgroup2.devices.allow: c 226:128 rwm +lxc.cgroup2.devices.allow: c 29:0 rwm +lxc.mount.entry: /dev/fb0 dev/fb0 none bind,optional,create=file +lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir +lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file +EOF + fi + else + if [[ "$APP" == "Channels" || "$APP" == "Emby" || "$APP" == "Frigate" || "$APP" == "Jellyfin" || "$APP" == "Plex" || "$APP" == "Scrypted" || "$APP" == "Tdarr" || "$APP" == "Unmanic" ]]; then + if [[ -e "/dev/dri/renderD128" ]]; then + if [[ -e "/dev/dri/card0" ]]; then + cat <>$LXC_CONFIG +# VAAPI hardware transcoding +dev0: /dev/dri/card0,gid=44 +dev1: /dev/dri/renderD128,gid=104 +EOF + else + cat <>$LXC_CONFIG +# VAAPI hardware transcoding +dev0: /dev/dri/card1,gid=44 +dev1: /dev/dri/renderD128,gid=104 +EOF + fi + fi + fi + fi + + # This starts the container and executes -install.sh + msg_info "Starting LXC Container" + pct start "$CTID" + msg_ok "Started LXC Container" + if [ "$var_os" == "alpine" ]; then + sleep 3 + pct exec "$CTID" -- /bin/sh -c 'cat </etc/apk/repositories +http://dl-cdn.alpinelinux.org/alpine/latest-stable/main +http://dl-cdn.alpinelinux.org/alpine/latest-stable/community +#http://dl-cdn.alpinelinux.org/alpine/v3.19/main +#http://dl-cdn.alpinelinux.org/alpine/v3.19/community +EOF' + pct exec "$CTID" -- ash -c "apk add bash >/dev/null" + fi + lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$var_install.sh)" || exit + +} + +# This function sets the description of the container. +description() { + IP=$(pct exec "$CTID" ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1) + pct set "$CTID" -description "
+ + # ${APP} LXC + + +
" + if [[ -f /etc/systemd/system/ping-instances.service ]]; then + systemctl start ping-instances.service + fi +} diff --git a/misc/clean-lxcs.sh b/misc/clean-lxcs.sh new file mode 100644 index 00000000..17f4fe74 --- /dev/null +++ b/misc/clean-lxcs.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info() { + clear + cat <<"EOF" + ________ __ _ ________ + / ____/ /__ ____ _____ / / | |/ / ____/ + / / / / _ \/ __ `/ __ \ / / | / / +/ /___/ / __/ /_/ / / / / / /___/ / /___ +\____/_/\___/\__,_/_/ /_/ /_____/_/|_\____/ + +EOF +} +BL=$(echo "\033[36m") +RD=$(echo "\033[01;31m") +CM='\xE2\x9C\x94\033' +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +header_info +echo "Loading..." +whiptail --backtitle "Proxmox VE Helper Scripts" --title "Proxmox VE LXC Updater" --yesno "This Will Clean logs, cache and update apt lists on selected LXC Containers. Proceed?" 10 58 || exit +NODE=$(hostname) +EXCLUDE_MENU=() +MSG_MAX_LENGTH=0 +while read -r TAG ITEM; do + OFFSET=2 + ((${#ITEM} + OFFSET > MSG_MAX_LENGTH)) && MSG_MAX_LENGTH=${#ITEM}+OFFSET + EXCLUDE_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') +excluded_containers=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Containers on $NODE" --checklist "\nSelect containers to skip from cleaning:\n" \ + 16 $((MSG_MAX_LENGTH + 23)) 6 "${EXCLUDE_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit + +function clean_container() { + container=$1 + header_info + name=$(pct exec "$container" hostname) + echo -e "${BL}[Info]${GN} Cleaning ${name} ${CL} \n" + pct exec $container -- bash -c "apt-get -y --purge autoremove && apt-get -y autoclean && bash <(curl -fsSL https://github.com/tteck/Proxmox/raw/main/misc/clean.sh) && rm -rf /var/lib/apt/lists/* && apt-get update" +} +for container in $(pct list | awk '{if(NR>1) print $1}'); do + if [[ " ${excluded_containers[@]} " =~ " $container " ]]; then + header_info + echo -e "${BL}[Info]${GN} Skipping ${BL}$container${CL}" + sleep 1 + else + os=$(pct config "$container" | awk '/^ostype/ {print $2}') + if [ "$os" != "debian" ] && [ "$os" != "ubuntu" ]; then + header_info + echo -e "${BL}[Info]${GN} Skipping ${name} ${RD}$container is not Debian or Ubuntu ${CL} \n" + sleep 1 + continue + fi + + status=$(pct status $container) + template=$(pct config $container | grep -q "template:" && echo "true" || echo "false") + if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then + echo -e "${BL}[Info]${GN} Starting${BL} $container ${CL} \n" + pct start $container + echo -e "${BL}[Info]${GN} Waiting For${BL} $container${CL}${GN} To Start ${CL} \n" + sleep 5 + clean_container $container + echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL} \n" + pct shutdown $container & + elif [ "$status" == "status: running" ]; then + clean_container $container + fi + fi +done + +wait +header_info +echo -e "${GN} Finished, Selected Containers Cleaned. ${CL} \n" diff --git a/misc/clean.sh b/misc/clean.sh new file mode 100644 index 00000000..4f692366 --- /dev/null +++ b/misc/clean.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info() { + clear + cat <<"EOF" + ________ __ _ ________ + / ____/ /__ ____ _____ / / | |/ / ____/ + / / / / _ \/ __ `/ __ \ / / | / / +/ /___/ / __/ /_/ / / / / / /___/ / /___ +\____/_/\___/\__,_/_/ /_/ /_____/_/|_\____/ + +EOF +} +BL=$(echo "\033[36m") +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +name=$(hostname) +header_info +echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n" +cache=$(find /var/cache/ -type f) +if [[ -z "$cache" ]]; then + echo -e "It appears there are no cached files on your system. \n" + sleep 2 +else + find /var/cache -type f -delete + echo "Successfully Removed Cache" + sleep 2 +fi +header_info +echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n" +logs=$(find /var/log/ -type f) +if [[ -z "$logs" ]]; then + echo -e "It appears there are no logs on your system. \n" + sleep 2 +else + find /var/log -type f -delete + echo "Successfully Removed Logs" + sleep 2 +fi +header_info +echo -e "${BL}[Info]${GN} Cleaning $name${CL} \n" +echo -e "${GN}Populating apt lists${CL} \n" diff --git a/misc/code-server.sh b/misc/code-server.sh new file mode 100644 index 00000000..0eb46dcf --- /dev/null +++ b/misc/code-server.sh @@ -0,0 +1,96 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + cat <<"EOF" + ______ __ _____ + / ____/___ ____/ /__ / ___/___ ______ _____ _____ + / / / __ \/ __ / _ \ \__ \/ _ \/ ___/ | / / _ \/ ___/ +/ /___/ /_/ / /_/ / __/ ___/ / __/ / | |/ / __/ / +\____/\____/\__,_/\___/ /____/\___/_/ |___/\___/_/ + +EOF +} +IP=$(hostname -I | awk '{print $1}') +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +APP="Code Server" +hostname="$(hostname)" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR + +function error_exit() { + trap - ERR + local reason="Unknown failure occured." + local msg="${1:-$reason}" + local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit $EXIT +} +clear +header_info +if command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Can't Install on Proxmox "; exit; fi +if [ -e /etc/alpine-release ]; then echo -e "⚠️ Can't Install on Alpine"; exit; fi +while true; do + read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +msg_info "Installing Dependencies" +apt-get update &>/dev/null +apt-get install -y curl &>/dev/null +apt-get install -y git &>/dev/null +msg_ok "Installed Dependencies" + +VERSION=$(curl -s https://api.github.com/repos/coder/code-server/releases/latest | + grep "tag_name" | + awk '{print substr($2, 3, length($2)-4) }') + +msg_info "Installing Code-Server v${VERSION}" +curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_amd64.deb &>/dev/null +dpkg -i code-server_${VERSION}_amd64.deb &>/dev/null +rm -rf code-server_${VERSION}_amd64.deb +mkdir -p ~/.config/code-server/ +systemctl enable -q --now code-server@$USER +cat <~/.config/code-server/config.yaml +bind-addr: 0.0.0.0:8680 +auth: none +password: +cert: false +EOF +systemctl restart code-server@$USER +msg_ok "Installed Code-Server v${VERSION} on $hostname" + +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://$IP:8680${CL} \n" diff --git a/misc/container-restore-from-backup.sh b/misc/container-restore-from-backup.sh new file mode 100644 index 00000000..c491e18a --- /dev/null +++ b/misc/container-restore-from-backup.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +clear +if command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Can't Run from the Proxmox Shell"; exit; fi +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" +APP="Home Assistant Container" +while true; do + read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +clear +function header_info { + cat <<"EOF" + __ __ ___ _ __ __ + / / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_ + / /_/ / __ \/ __ `__ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/ + / __ / /_/ / / / / / / __/ / ___ |(__ |__ ) (__ ) /_/ /_/ / / / / /_ +/_/ /_/\____/_/ /_/ /_/\___/ /_/ |_/____/____/_/____/\__/\__,_/_/ /_/\__/ + RESTORE FROM BACKUP +EOF +} + +header_info + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} +if [ -z "$(ls -A /var/lib/docker/volumes/hass_config/_data/backups/)" ]; then + msg_error "No backups found! \n" + exit 1 +fi +DIR=/var/lib/docker/volumes/hass_config/_data/restore +if [ -d "$DIR" ]; then + msg_ok "Restore Directory Exists." +else + mkdir -p /var/lib/docker/volumes/hass_config/_data/restore + msg_ok "Created Restore Directory." +fi +cd /var/lib/docker/volumes/hass_config/_data/backups/ +PS3="Please enter your choice: " +files="$(ls -A .)" +select filename in ${files}; do + msg_ok "You selected ${BL}${filename}${CL}" + break +done +msg_info "Stopping Home Assistant" +docker stop homeassistant &>/dev/null +msg_ok "Stopped Home Assistant" +msg_info "Restoring Home Assistant using ${filename}" +tar xvf ${filename} -C /var/lib/docker/volumes/hass_config/_data/restore &>/dev/null +cd /var/lib/docker/volumes/hass_config/_data/restore +tar -xvf homeassistant.tar.gz &>/dev/null +if ! command -v rsync >/dev/null 2>&1; then apt-get install -y rsync &>/dev/null; fi +rsync -a /var/lib/docker/volumes/hass_config/_data/restore/data/ /var/lib/docker/volumes/hass_config/_data +rm -rf /var/lib/docker/volumes/hass_config/_data/restore/* +msg_ok "Restore Complete" +msg_ok "Starting Home Assistant \n" +docker start homeassistant diff --git a/misc/copy-data/README.md b/misc/copy-data/README.md new file mode 100644 index 00000000..e24677c3 --- /dev/null +++ b/misc/copy-data/README.md @@ -0,0 +1,46 @@ +

Copy data to another LXC (run in the Proxmox Shell)

+
To copy data from Home Assistant Container to Home Assistant Container
+ +``` +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/copy-data/home-assistant-container-copy-data-home-assistant-container.sh)" +``` +
To copy data from Home Assistant Container to Home Assistant Core
+ +``` +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/copy-data/home-assistant-container-copy-data-home-assistant-core.sh)" +``` +
To copy data from Home Assistant Container to Podman Home Assistant
+ +``` +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh)" +``` +
To copy data from Podman Home Assistant to Home Assistant Container
+ +``` +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh)" +``` +
To copy data from Home Assistant Core to Home Assistant Container
+ +``` +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/copy-data/home-assistant-core-copy-data-home-assistant-container.sh)" +``` +
To copy data from Home Assistant Core to Home Assistant Core
+ +``` +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/copy-data/home-assistant-core-copy-data-home-assistant-core.sh)" +``` +
To copy data from Plex to Plex
+ +``` +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/copy-data/plex-copy-data-plex.sh)" +``` +
To copy data from Zigbee2MQTT to Zigbee2MQTT
+ +``` +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/copy-data/z2m-copy-data-z2m.sh)" +``` +
To copy data from Zwavejs2MQTT to Zwave JS UI
+ +``` +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh)" +``` diff --git a/misc/copy-data/home-assistant-container-copy-data-home-assistant-container.sh b/misc/copy-data/home-assistant-container-copy-data-home-assistant-container.sh new file mode 100644 index 00000000..7b5fe050 --- /dev/null +++ b/misc/copy-data/home-assistant-container-copy-data-home-assistant-container.sh @@ -0,0 +1,128 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +# Use to copy all data from one Home Assistant LXC to another +# run from the Proxmox Shell +clear +if ! command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Run from the Proxmox Shell"; exit; fi +while true; do + read -p "Use to copy all data from one Home Assistant LXC to another. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +trap cleanup EXIT + +function error_exit() { + trap - ERR + local DEFAULT='Unknown failure occured.' + local REASON="\e[97m${1:-$DEFAULT}\e[39m" + local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" + msg "$FLAG $REASON" + exit $EXIT +} +function warn() { + local REASON="\e[97m$1\e[39m" + local FLAG="\e[93m[WARNING]\e[39m" + msg "$FLAG $REASON" +} +function info() { + local REASON="$1" + local FLAG="\e[36m[INFO]\e[39m" + msg "$FLAG $REASON" +} +function msg() { + local TEXT="$1" + echo -e "$TEXT" +} +function cleanup() { + [ -d "${CTID_FROM_PATH:-}" ] && pct unmount $CTID_FROM + [ -d "${CTID_TO_PATH:-}" ] && pct unmount $CTID_TO + popd >/dev/null + rm -rf $TEMP_DIR +} +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null + +TITLE="Home Assistant LXC Data Copy" +while read -r line; do + TAG=$(echo "$line" | awk '{print $1}') + ITEM=$(echo "$line" | awk '{print substr($0,36)}') + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + CTID_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') +while [ -z "${CTID_FROM:+x}" ]; do + CTID_FROM=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich HA LXC would you like to copy FROM?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +while [ -z "${CTID_TO:+x}" ]; do + CTID_TO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich HA LXC would you like to copy TO?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +for i in ${!CTID_MENU[@]}; do + [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && + CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) + [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && + CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) +done +whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "$TITLE" --yesno \ + "Are you sure you want to copy data between the following LXCs? +$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME}) +Version: 2022.01.23" 13 50 || exit +info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'" +if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then + msg "Stopping '$CTID_TO'..." + pct stop $CTID_TO +fi +msg "Mounting Container Disks..." +DOCKER_PATH=/var/lib/docker/volumes/hass_config/ +CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_FROM}'." +[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] || + die "Home Assistant directories in '$CTID_FROM' not found." +CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_TO}'." +[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] || + die "Home Assistant directories in '$CTID_TO' not found." + +rm -rf ${CTID_TO_PATH}${DOCKER_PATH} +mkdir ${CTID_TO_PATH}${DOCKER_PATH} + +msg "Copying Data Between Containers..." +RSYNC_OPTIONS=( + --archive + --hard-links + --sparse + --xattrs + --no-inc-recursive + --info=progress2 +) +msg "<======== Docker Data ========>" +rsync ${RSYNC_OPTIONS[*]} ${CTID_FROM_PATH}${DOCKER_PATH} ${CTID_TO_PATH}${DOCKER_PATH} +echo -en "\e[1A\e[0K\e[1A\e[0K" + +info "Successfully Transferred Data." + +# Use to copy all data from one Home Assistant LXC to another +# run from the Proxmox Shell +# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/copy-data/home-assistant-container-copy-data-home-assistant-container.sh)" diff --git a/misc/copy-data/home-assistant-container-copy-data-home-assistant-core.sh b/misc/copy-data/home-assistant-container-copy-data-home-assistant-core.sh new file mode 100644 index 00000000..36af3259 --- /dev/null +++ b/misc/copy-data/home-assistant-container-copy-data-home-assistant-core.sh @@ -0,0 +1,124 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +clear +if ! command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Run from the Proxmox Shell"; exit; fi +while true; do + read -p "Use to copy all data from a Home Assistant Container LXC to a Home Assistant Core LXC. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +trap cleanup EXIT + +function error_exit() { + trap - ERR + local DEFAULT='Unknown failure occured.' + local REASON="\e[97m${1:-$DEFAULT}\e[39m" + local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" + msg "$FLAG $REASON" + exit $EXIT +} +function warn() { + local REASON="\e[97m$1\e[39m" + local FLAG="\e[93m[WARNING]\e[39m" + msg "$FLAG $REASON" +} +function info() { + local REASON="$1" + local FLAG="\e[36m[INFO]\e[39m" + msg "$FLAG $REASON" +} +function msg() { + local TEXT="$1" + echo -e "$TEXT" +} +function cleanup() { + [ -d "${CTID_FROM_PATH:-}" ] && pct unmount $CTID_FROM + [ -d "${CTID_TO_PATH:-}" ] && pct unmount $CTID_TO + popd >/dev/null + rm -rf $TEMP_DIR +} +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null + +TITLE="Home Assistant LXC Data Copy" +while read -r line; do + TAG=$(echo "$line" | awk '{print $1}') + ITEM=$(echo "$line" | awk '{print substr($0,36)}') + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + CTID_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') +while [ -z "${CTID_FROM:+x}" ]; do + CTID_FROM=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich HA Container LXC would you like to copy FROM?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +while [ -z "${CTID_TO:+x}" ]; do + CTID_TO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich HA Core LXC would you like to copy TO?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +for i in ${!CTID_MENU[@]}; do + [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && + CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) + [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && + CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) +done +whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "$TITLE" --yesno \ + "Are you sure you want to copy data between the following LXCs? +$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME}) +Version: 2022.10.02" 13 50 || exit +info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'" +if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then + msg "Stopping '$CTID_TO'..." + pct stop $CTID_TO +fi +msg "Mounting Container Disks..." +DOCKER_PATH=/var/lib/docker/volumes/hass_config/_data +CORE_PATH=/root/.homeassistant +CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_FROM}'." +[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] || + die "Home Assistant directories in '$CTID_FROM' not found." +CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_TO}'." +[ -d "${CTID_TO_PATH}${CORE_PATH}" ] || + die "Home Assistant directories in '$CTID_TO' not found." + +msg "Copying Data..." +RSYNC_OPTIONS=( + --archive + --hard-links + --sparse + --xattrs + --no-inc-recursive + --info=progress2 +) +msg "<======== Docker Data ========>" +rsync ${RSYNC_OPTIONS[*]} ${CTID_FROM_PATH}${DOCKER_PATH} ${CTID_TO_PATH}${CORE_PATH} +echo -en "\e[1A\e[0K\e[1A\e[0K" + +info "Successfully Transferred Data." + +# Use to copy all data from a Home Assistant Container LXC to a Home Assistant Core LXC +# run from the Proxmox Shell +# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/copy-data/home-assistant-container-copy-data-home-assistant-core.sh)" diff --git a/misc/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh b/misc/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh new file mode 100644 index 00000000..2423f896 --- /dev/null +++ b/misc/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh @@ -0,0 +1,129 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +# Use to copy all data from a Home Assistant LXC to a Podman Home Assistant LXC. +# run from the Proxmox Shell +clear +if ! command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Run from the Proxmox Shell"; exit; fi +while true; do + read -p "Use to copy all data from a Home Assistant LXC to a Podman Home Assistant LXC. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +trap cleanup EXIT + +function error_exit() { + trap - ERR + local DEFAULT='Unknown failure occured.' + local REASON="\e[97m${1:-$DEFAULT}\e[39m" + local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" + msg "$FLAG $REASON" + exit $EXIT +} +function warn() { + local REASON="\e[97m$1\e[39m" + local FLAG="\e[93m[WARNING]\e[39m" + msg "$FLAG $REASON" +} +function info() { + local REASON="$1" + local FLAG="\e[36m[INFO]\e[39m" + msg "$FLAG $REASON" +} +function msg() { + local TEXT="$1" + echo -e "$TEXT" +} +function cleanup() { + [ -d "${CTID_FROM_PATH:-}" ] && pct unmount $CTID_FROM + [ -d "${CTID_TO_PATH:-}" ] && pct unmount $CTID_TO + popd >/dev/null + rm -rf $TEMP_DIR +} +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null + +TITLE="Home Assistant LXC Data Copy" +while read -r line; do + TAG=$(echo "$line" | awk '{print $1}') + ITEM=$(echo "$line" | awk '{print substr($0,36)}') + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + CTID_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') +while [ -z "${CTID_FROM:+x}" ]; do + CTID_FROM=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich HA LXC would you like to copy FROM?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +while [ -z "${CTID_TO:+x}" ]; do + CTID_TO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich HA Podman LXC would you like to copy TO?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +for i in ${!CTID_MENU[@]}; do + [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && + CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) + [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && + CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) +done +whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "$TITLE" --yesno \ + "Are you sure you want to copy data between the following LXCs? +$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME}) +Version: 2022.02.12" 13 50 || exit +info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'" +if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then + msg "Stopping '$CTID_TO'..." + pct stop $CTID_TO +fi +msg "Mounting Container Disks..." +DOCKER_PATH=/var/lib/docker/volumes/hass_config/ +PODMAN_PATH=/var/lib/containers/storage/volumes/hass_config/ +CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_FROM}'." +[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] || + die "Home Assistant directories in '$CTID_FROM' not found." +CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_TO}'." +[ -d "${CTID_TO_PATH}${PODMAN_PATH}" ] || + die "Home Assistant directories in '$CTID_TO' not found." + +rm -rf ${CTID_TO_PATH}${PODMAN_PATH} +mkdir ${CTID_TO_PATH}${PODMAN_PATH} + +msg "Copying Data Between Containers..." +RSYNC_OPTIONS=( + --archive + --hard-links + --sparse + --xattrs + --no-inc-recursive + --info=progress2 +) +msg "<======== Docker Data ========>" +rsync ${RSYNC_OPTIONS[*]} ${CTID_FROM_PATH}${DOCKER_PATH} ${CTID_TO_PATH}${PODMAN_PATH} +echo -en "\e[1A\e[0K\e[1A\e[0K" + +info "Successfully Transferred Data." + +# Use to copy all data from a Home Assistant LXC to a Podman Home Assistant LXC +# run from the Proxmox Shell +# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/copy-data/home-assistant-container-copy-data-podman-home-assistant.sh)" diff --git a/misc/copy-data/home-assistant-core-copy-data-home-assistant-container.sh b/misc/copy-data/home-assistant-core-copy-data-home-assistant-container.sh new file mode 100644 index 00000000..387450fc --- /dev/null +++ b/misc/copy-data/home-assistant-core-copy-data-home-assistant-container.sh @@ -0,0 +1,124 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +clear +if ! command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Run from the Proxmox Shell"; exit; fi +while true; do + read -p "Use to copy all data from a Home Assistant Core LXC to a Home Assistant Container LXC. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +trap cleanup EXIT + +function error_exit() { + trap - ERR + local DEFAULT='Unknown failure occured.' + local REASON="\e[97m${1:-$DEFAULT}\e[39m" + local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" + msg "$FLAG $REASON" + exit $EXIT +} +function warn() { + local REASON="\e[97m$1\e[39m" + local FLAG="\e[93m[WARNING]\e[39m" + msg "$FLAG $REASON" +} +function info() { + local REASON="$1" + local FLAG="\e[36m[INFO]\e[39m" + msg "$FLAG $REASON" +} +function msg() { + local TEXT="$1" + echo -e "$TEXT" +} +function cleanup() { + [ -d "${CTID_FROM_PATH:-}" ] && pct unmount $CTID_FROM + [ -d "${CTID_TO_PATH:-}" ] && pct unmount $CTID_TO + popd >/dev/null + rm -rf $TEMP_DIR +} +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null + +TITLE="Home Assistant LXC Data Copy" +while read -r line; do + TAG=$(echo "$line" | awk '{print $1}') + ITEM=$(echo "$line" | awk '{print substr($0,36)}') + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + CTID_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') +while [ -z "${CTID_FROM:+x}" ]; do + CTID_FROM=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich HA Core LXC would you like to copy FROM?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +while [ -z "${CTID_TO:+x}" ]; do + CTID_TO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich HA Container LXC would you like to copy TO?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +for i in ${!CTID_MENU[@]}; do + [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && + CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) + [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && + CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) +done +whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "$TITLE" --yesno \ + "Are you sure you want to copy data between the following LXCs? +$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME}) +Version: 2022.10.02" 13 50 || exit +info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'" +if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then + msg "Stopping '$CTID_TO'..." + pct stop $CTID_TO +fi +msg "Mounting Container Disks..." +DOCKER_PATH=/var/lib/docker/volumes/hass_config/_data +CORE_PATH=/root/.homeassistant +CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_FROM}'." +[ -d "${CTID_FROM_PATH}${CORE_PATH}" ] || + die "Home Assistant directories in '$CTID_FROM' not found." +CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_TO}'." +[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] || + die "Home Assistant directories in '$CTID_TO' not found." + +msg "Copying Data..." +RSYNC_OPTIONS=( + --archive + --hard-links + --sparse + --xattrs + --no-inc-recursive + --info=progress2 +) +msg "<======== Docker Data ========>" +rsync ${RSYNC_OPTIONS[*]} ${CTID_FROM_PATH}${CORE_PATH} ${CTID_TO_PATH}${DOCKER_PATH} +echo -en "\e[1A\e[0K\e[1A\e[0K" + +info "Successfully Transferred Data." + +# Use to copy all data from a Home Assistant Core LXC to a Home Assistant Container LXC +# run from the Proxmox Shell +# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/copy-data/home-assistant-core-copy-data-home-assistant-container.sh)" diff --git a/misc/copy-data/home-assistant-core-copy-data-home-assistant-core.sh b/misc/copy-data/home-assistant-core-copy-data-home-assistant-core.sh new file mode 100644 index 00000000..68c388ed --- /dev/null +++ b/misc/copy-data/home-assistant-core-copy-data-home-assistant-core.sh @@ -0,0 +1,123 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +clear +if ! command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Run from the Proxmox Shell"; exit; fi +while true; do + read -p "Use to copy all data from a Home Assistant Core LXC to a Home Assistant Core LXC. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +trap cleanup EXIT + +function error_exit() { + trap - ERR + local DEFAULT='Unknown failure occured.' + local REASON="\e[97m${1:-$DEFAULT}\e[39m" + local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" + msg "$FLAG $REASON" + exit $EXIT +} +function info() { + local REASON="$1" + local FLAG="\e[36m[INFO]\e[39m" + msg "$FLAG $REASON" +} +function msg() { + local TEXT="$1" + echo -e "$TEXT" +} +function cleanup() { + [ -d "${CTID_FROM_PATH:-}" ] && pct unmount $CTID_FROM + [ -d "${CTID_TO_PATH:-}" ] && pct unmount $CTID_TO + popd >/dev/null + rm -rf $TEMP_DIR +} +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null + +TITLE="Home Assistant LXC Data Copy" +while read -r line; do + TAG=$(echo "$line" | awk '{print $1}') + ITEM=$(echo "$line" | awk '{print substr($0,36)}') + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + CTID_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') +while [ -z "${CTID_FROM:+x}" ]; do + CTID_FROM=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich HA Core LXC would you like to copy FROM?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +while [ -z "${CTID_TO:+x}" ]; do + CTID_TO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich HA Core LXC would you like to copy TO?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +for i in ${!CTID_MENU[@]}; do + [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && + CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) + [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && + CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) +done +whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "$TITLE" --yesno \ + "Are you sure you want to copy data between the following LXCs? +$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME}) +Version: 2022.10.03" 13 50 || exit +info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'" +if [ $(pct status $CTID_FROM | sed 's/.* //') == 'running' ]; then + msg "Stopping '$CTID_FROM'..." + pct stop $CTID_FROM +fi +if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then + msg "Stopping '$CTID_TO'..." + pct stop $CTID_TO +fi +msg "Mounting Container Disks..." +CORE_PATH=/root/.homeassistant +CORE_PATH2=/root/ +CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_FROM}'." +[ -d "${CTID_FROM_PATH}${CORE_PATH}" ] || + die "Home Assistant directories in '$CTID_FROM' not found." +CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_TO}'." +[ -d "${CTID_TO_PATH}${CORE_PATH2}" ] || + die "Home Assistant directories in '$CTID_TO' not found." + +msg "Copying Data..." +RSYNC_OPTIONS=( + --archive + --hard-links + --sparse + --xattrs + --no-inc-recursive + --info=progress2 +) +msg "<======== Docker Data ========>" +rsync ${RSYNC_OPTIONS[*]} ${CTID_FROM_PATH}${CORE_PATH} ${CTID_TO_PATH}${CORE_PATH2} +echo -en "\e[1A\e[0K\e[1A\e[0K" + +info "Successfully Transferred Data." + +# Use to copy all data from a Home Assistant Core LXC to a Home Assistant Container LXC +# run from the Proxmox Shell +# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/copy-data/home-assistant-core-copy-data-home-assistant-core.sh)" diff --git a/misc/copy-data/plex-copy-data-plex.sh b/misc/copy-data/plex-copy-data-plex.sh new file mode 100644 index 00000000..dbf80f18 --- /dev/null +++ b/misc/copy-data/plex-copy-data-plex.sh @@ -0,0 +1,128 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +# Use to copy all data from one Plex Media Server LXC to another +# run from the Proxmox Shell +clear +if ! command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Run from the Proxmox Shell"; exit; fi +while true; do + read -p "Use to copy all data from one Plex Media Server LXC to another. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +trap cleanup EXIT + +function error_exit() { + trap - ERR + local DEFAULT='Unknown failure occured.' + local REASON="\e[97m${1:-$DEFAULT}\e[39m" + local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" + msg "$FLAG $REASON" + exit $EXIT +} +function warn() { + local REASON="\e[97m$1\e[39m" + local FLAG="\e[93m[WARNING]\e[39m" + msg "$FLAG $REASON" +} +function info() { + local REASON="$1" + local FLAG="\e[36m[INFO]\e[39m" + msg "$FLAG $REASON" +} +function msg() { + local TEXT="$1" + echo -e "$TEXT" +} +function cleanup() { + [ -d "${CTID_FROM_PATH:-}" ] && pct unmount $CTID_FROM + [ -d "${CTID_TO_PATH:-}" ] && pct unmount $CTID_TO + popd >/dev/null + rm -rf $TEMP_DIR +} +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null + +TITLE="Plex Media Server LXC Data Copy" +while read -r line; do + TAG=$(echo "$line" | awk '{print $1}') + ITEM=$(echo "$line" | awk '{print substr($0,36)}') + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + CTID_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') +while [ -z "${CTID_FROM:+x}" ]; do + CTID_FROM=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich Plex Media Server LXC would you like to copy FROM?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +while [ -z "${CTID_TO:+x}" ]; do + CTID_TO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich Plex Media Server LXC would you like to copy TO?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +for i in ${!CTID_MENU[@]}; do + [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && + CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) + [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && + CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) +done +whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "$TITLE" --yesno \ + "Are you sure you want to copy data between the following LXCs? +$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME}) +Version: 2022.01.24" 13 50 || exit +info "Plex Media Server Data from '$CTID_FROM' to '$CTID_TO'" +if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then + msg "Stopping '$CTID_TO'..." + pct stop $CTID_TO +fi +msg "Mounting Container Disks..." +DATA_PATH=/var/lib/plexmediaserver/Library/ +CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_FROM}'." +[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] || + die "Plex Media Server directories in '$CTID_FROM' not found." +CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_TO}'." +[ -d "${CTID_TO_PATH}${DATA_PATH}" ] || + die "Plex Media Server directories in '$CTID_TO' not found." + +#rm -rf ${CTID_TO_PATH}${DATA_PATH} +#mkdir ${CTID_TO_PATH}${DATA_PATH} + +msg "Copying Data Between Containers..." +RSYNC_OPTIONS=( + --archive + --hard-links + --sparse + --xattrs + --no-inc-recursive + --info=progress2 +) +msg "<======== Plex Media Server Data ========>" +rsync ${RSYNC_OPTIONS[*]} ${CTID_FROM_PATH}${DATA_PATH} ${CTID_TO_PATH}${DATA_PATH} +echo -en "\e[1A\e[0K\e[1A\e[0K" + +info "Successfully Transferred Data." + +# Use to copy all data from one Plex Media Server LXC to another +# run from the Proxmox Shell +# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/copy-data/plex-copy-data-plex.sh)" diff --git a/misc/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh b/misc/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh new file mode 100644 index 00000000..ef65e9e6 --- /dev/null +++ b/misc/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh @@ -0,0 +1,129 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +# Use to copy all data from a Podman Home Assistant LXC to a Docker Home Assistant LXC. +# run from the Proxmox Shell +clear +if ! command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Run from the Proxmox Shell"; exit; fi +while true; do + read -p "Use to copy all data from a Podman Home Assistant LXC to a Docker Home Assistant LXC. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +trap cleanup EXIT + +function error_exit() { + trap - ERR + local DEFAULT='Unknown failure occured.' + local REASON="\e[97m${1:-$DEFAULT}\e[39m" + local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" + msg "$FLAG $REASON" + exit $EXIT +} +function warn() { + local REASON="\e[97m$1\e[39m" + local FLAG="\e[93m[WARNING]\e[39m" + msg "$FLAG $REASON" +} +function info() { + local REASON="$1" + local FLAG="\e[36m[INFO]\e[39m" + msg "$FLAG $REASON" +} +function msg() { + local TEXT="$1" + echo -e "$TEXT" +} +function cleanup() { + [ -d "${CTID_FROM_PATH:-}" ] && pct unmount $CTID_FROM + [ -d "${CTID_TO_PATH:-}" ] && pct unmount $CTID_TO + popd >/dev/null + rm -rf $TEMP_DIR +} +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null + +TITLE="Home Assistant LXC Data Copy" +while read -r line; do + TAG=$(echo "$line" | awk '{print $1}') + ITEM=$(echo "$line" | awk '{print substr($0,36)}') + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + CTID_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') +while [ -z "${CTID_FROM:+x}" ]; do + CTID_FROM=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich HA Podman LXC would you like to copy FROM?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +while [ -z "${CTID_TO:+x}" ]; do + CTID_TO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich HA LXC would you like to copy TO?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +for i in ${!CTID_MENU[@]}; do + [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && + CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) + [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && + CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) +done +whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "$TITLE" --yesno \ + "Are you sure you want to copy data between the following LXCs? +$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME}) +Version: 2022.03.31" 13 50 || exit +info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'" +if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then + msg "Stopping '$CTID_TO'..." + pct stop $CTID_TO +fi +msg "Mounting Container Disks..." +DOCKER_PATH=/var/lib/docker/volumes/hass_config/ +PODMAN_PATH=/var/lib/containers/storage/volumes/hass_config/ +CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_FROM}'." +[ -d "${CTID_FROM_PATH}${PODMAN_PATH}" ] || + die "Home Assistant directories in '$CTID_FROM' not found." +CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_TO}'." +[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] || + die "Home Assistant directories in '$CTID_TO' not found." + +rm -rf ${CTID_TO_PATH}${DOCKER_PATH} +mkdir ${CTID_TO_PATH}${DOCKER_PATH} + +msg "Copying Data Between Containers..." +RSYNC_OPTIONS=( + --archive + --hard-links + --sparse + --xattrs + --no-inc-recursive + --info=progress2 +) +msg "<======== Data ========>" +rsync ${RSYNC_OPTIONS[*]} ${CTID_FROM_PATH}${PODMAN_PATH} ${CTID_TO_PATH}${DOCKER_PATH} +echo -en "\e[1A\e[0K\e[1A\e[0K" + +info "Successfully Transferred Data." + +# Use to copy all data from a Podman Home Assistant LXC to a Docker Home Assistant LXC. +# run from the Proxmox Shell +# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/copy-data/podman-home-assistant-copy-data-home-assistant-container.sh)" diff --git a/misc/copy-data/z2m-copy-data-z2m.sh b/misc/copy-data/z2m-copy-data-z2m.sh new file mode 100644 index 00000000..6e804de5 --- /dev/null +++ b/misc/copy-data/z2m-copy-data-z2m.sh @@ -0,0 +1,128 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +# Use to copy all data from one Zigbee2MQTT LXC to another +# run from the Proxmox Shell +clear +if ! command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Run from the Proxmox Shell"; exit; fi +while true; do + read -p "Use to copy all data from one Zigbee2MQTT LXC to another. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +trap cleanup EXIT + +function error_exit() { + trap - ERR + local DEFAULT='Unknown failure occured.' + local REASON="\e[97m${1:-$DEFAULT}\e[39m" + local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" + msg "$FLAG $REASON" + exit $EXIT +} +function warn() { + local REASON="\e[97m$1\e[39m" + local FLAG="\e[93m[WARNING]\e[39m" + msg "$FLAG $REASON" +} +function info() { + local REASON="$1" + local FLAG="\e[36m[INFO]\e[39m" + msg "$FLAG $REASON" +} +function msg() { + local TEXT="$1" + echo -e "$TEXT" +} +function cleanup() { + [ -d "${CTID_FROM_PATH:-}" ] && pct unmount $CTID_FROM + [ -d "${CTID_TO_PATH:-}" ] && pct unmount $CTID_TO + popd >/dev/null + rm -rf $TEMP_DIR +} +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null + +TITLE="Zigbee2MQTT LXC Data Copy" +while read -r line; do + TAG=$(echo "$line" | awk '{print $1}') + ITEM=$(echo "$line" | awk '{print substr($0,36)}') + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + CTID_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') +while [ -z "${CTID_FROM:+x}" ]; do + CTID_FROM=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich Zigbee2MQTT LXC would you like to copy FROM?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +while [ -z "${CTID_TO:+x}" ]; do + CTID_TO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich Zigbee2MQTT LXC would you like to copy TO?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +for i in ${!CTID_MENU[@]}; do + [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && + CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) + [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && + CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) +done +whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "$TITLE" --yesno \ + "Are you sure you want to copy data between the following LXCs? +$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME}) +Version: 2022.01.23" 13 50 || exit +info "Zigbee2MQTT Data from '$CTID_FROM' to '$CTID_TO'" +if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then + msg "Stopping '$CTID_TO'..." + pct stop $CTID_TO +fi +msg "Mounting Container Disks..." +DATA_PATH=/opt/zigbee2mqtt/data/ +CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_FROM}'." +[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] || + die "Zigbee2igbee2MQTT directories in '$CTID_FROM' not found." +CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_TO}'." +[ -d "${CTID_TO_PATH}${DATA_PATH}" ] || + die "Zigbee2MQTT directories in '$CTID_TO' not found." + +#rm -rf ${CTID_TO_PATH}${DATA_PATH} +#mkdir ${CTID_TO_PATH}${DATA_PATH} + +msg "Copying Data Between Containers..." +RSYNC_OPTIONS=( + --archive + --hard-links + --sparse + --xattrs + --no-inc-recursive + --info=progress2 +) +msg "<======== Zigbee2MQTT Data ========>" +rsync ${RSYNC_OPTIONS[*]} ${CTID_FROM_PATH}${DATA_PATH} ${CTID_TO_PATH}${DATA_PATH} +echo -en "\e[1A\e[0K\e[1A\e[0K" + +info "Successfully Transferred Data." + +# Use to copy all data from one Zigbee2MQTT LXC to another +# run from the Proxmox Shell +# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/copy-data/z2m-copy-data-z2m.sh)" diff --git a/misc/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh b/misc/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh new file mode 100644 index 00000000..8d552982 --- /dev/null +++ b/misc/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh @@ -0,0 +1,130 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +# Use to copy all data from a Zwavejs2MQTT LXC to a Z-wave JS UI LXC +# run from the Proxmox Shell +clear +if ! command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Run from the Proxmox Shell"; exit; fi +while true; do + read -p "Use to copy all data from a Zwavejs2MQTT LXC to a Z-wave JS UI LXC. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +clear +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +trap cleanup EXIT + +function error_exit() { + trap - ERR + local DEFAULT='Unknown failure occured.' + local REASON="\e[97m${1:-$DEFAULT}\e[39m" + local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE" + msg "$FLAG $REASON" + exit $EXIT +} +function warn() { + local REASON="\e[97m$1\e[39m" + local FLAG="\e[93m[WARNING]\e[39m" + msg "$FLAG $REASON" +} +function info() { + local REASON="$1" + local FLAG="\e[36m[INFO]\e[39m" + msg "$FLAG $REASON" +} +function msg() { + local TEXT="$1" + echo -e "$TEXT" +} +function cleanup() { + [ -d "${CTID_FROM_PATH:-}" ] && pct unmount $CTID_FROM + [ -d "${CTID_TO_PATH:-}" ] && pct unmount $CTID_TO + popd >/dev/null + rm -rf $TEMP_DIR +} +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null + +TITLE="Zigbee2MQTT to Z-wave JS UI Data Copy" +while read -r line; do + TAG=$(echo "$line" | awk '{print $1}') + ITEM=$(echo "$line" | awk '{print substr($0,36)}') + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + CTID_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') +while [ -z "${CTID_FROM:+x}" ]; do + CTID_FROM=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich Zwavejs2MQTT LXC would you like to copy FROM?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +while [ -z "${CTID_TO:+x}" ]; do + CTID_TO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$TITLE" --radiolist \ + "\nWhich Z-wave JS UI LXC would you like to copy TO?\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done +for i in ${!CTID_MENU[@]}; do + [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && + CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) + [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && + CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]}) +done +whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "$TITLE" --yesno \ + "Are you sure you want to copy data between the following LXCs? +$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME}) +Version: 2022.09.21" 13 50 || exit +info "Zwavejs2MQTT Data from '$CTID_FROM' to '$CTID_TO'" +if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then + msg "Stopping '$CTID_TO'..." + pct stop $CTID_TO +fi +msg "Mounting Container Disks..." +DATA_PATH=/opt/zwavejs2mqtt/store/ +DATA_PATH_NEW=/opt/zwave-js-ui/store/ +CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_FROM}'." +[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] || + die "Zwavejs2MQTT directories in '$CTID_FROM' not found." +CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || + die "There was a problem mounting the root disk of LXC '${CTID_TO}'." +[ -d "${CTID_TO_PATH}${DATA_PATH_NEW}" ] || + die "Zwavejs2MQTT directories in '$CTID_TO' not found." + +#rm -rf ${CTID_TO_PATH}${DATA_PATH} +#mkdir ${CTID_TO_PATH}${DATA_PATH} + +msg "Copying Data Between Containers..." +RSYNC_OPTIONS=( + --archive + --hard-links + --sparse + --xattrs + --no-inc-recursive + --info=progress2 +) +msg "<======== Zwavejs Data ========>" +rsync ${RSYNC_OPTIONS[*]} ${CTID_FROM_PATH}${DATA_PATH} ${CTID_TO_PATH}${DATA_PATH_NEW} +echo -en "\e[1A\e[0K\e[1A\e[0K" + +info "Successfully Transferred Data." + +# Use to copy all data from a Zwavejs2MQTT LXC to a Z-wave JS UI LXC +# run from the Proxmox Shell +# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/copy-data/zwavejs2mqtt-copy-data-zwavejsui.sh)" diff --git a/misc/core-restore-from-backup.sh b/misc/core-restore-from-backup.sh new file mode 100644 index 00000000..885eda9c --- /dev/null +++ b/misc/core-restore-from-backup.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +clear +if command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Can't Run from the Proxmox Shell"; exit; fi +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" +APP="Home Assistant Core" +while true; do + read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +clear +function header_info { + cat <<"EOF" + __ __ ___ _ __ __ ______ + / / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_ / ____/___ ________ + / /_/ / __ \/ __ `__ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/ / / / __ \/ ___/ _ \ + / __ / /_/ / / / / / / __/ / ___ |(__ |__ ) (__ ) /_/ /_/ / / / / /_ / /___/ /_/ / / / __/ +/_/ /_/\____/_/ /_/ /_/\___/ /_/ |_/____/____/_/____/\__/\__,_/_/ /_/\__/ \____/\____/_/ \___/ + RESTORE FROM BACKUP +EOF +} + +header_info + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} +if [ -z "$(ls -A /root/.homeassistant/backups/)" ]; then + msg_error "No backups found! \n" + exit 1 +fi +DIR=/root/.homeassistant/restore +if [ -d "$DIR" ]; then + msg_ok "Restore Directory Exists." +else + mkdir -p /root/.homeassistant/restore + msg_ok "Created Restore Directory." +fi +cd /root/.homeassistant/backups/ +PS3="Please enter your choice: " +files="$(ls -A .)" +select filename in ${files}; do + msg_ok "You selected ${BL}${filename}${CL}" + break +done +msg_info "Stopping Home Assistant" +sudo service homeassistant stop +msg_ok "Stopped Home Assistant" +msg_info "Restoring Home Assistant using ${filename}" +tar xvf ${filename} -C /root/.homeassistant/restore &>/dev/null +cd /root/.homeassistant/restore +tar -xvf homeassistant.tar.gz &>/dev/null +if ! command -v rsync >/dev/null 2>&1; then apt-get install -y rsync &>/dev/null; fi +rsync -a /root/.homeassistant/restore/data/ /root/.homeassistant +rm -rf /root/.homeassistant/restore/* +msg_ok "Restore Complete" +msg_ok "Starting Home Assistant \n" +sudo service homeassistant start diff --git a/misc/cron-update-lxcs.sh b/misc/cron-update-lxcs.sh new file mode 100644 index 00000000..97fb4e6c --- /dev/null +++ b/misc/cron-update-lxcs.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +# bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/cron-update-lxcs.sh)" + +clear +cat <<"EOF" + ______ __ __ __ __ __ _ ________ + / ____/________ ____ / / / /___ ____/ /___ _/ /____ / / | |/ / ____/____ + / / / ___/ __ \/ __ \ / / / / __ \/ __ / __ `/ __/ _ \ / / | / / / ___/ +/ /___/ / / /_/ / / / / / /_/ / /_/ / /_/ / /_/ / /_/ __/ / /___/ / /___(__ ) +\____/_/ \____/_/ /_/ \____/ .___/\__,_/\__,_/\__/\___/ /_____/_/|_\____/____/ + /_/ +EOF + +add() { + while true; do + read -p "This script will add a crontab schedule that updates all LXCs every Sunday at midnight. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac + done + sh -c '(crontab -l -u root 2>/dev/null; echo "0 0 * * 0 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /bin/bash -c \"\$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/update-lxcs-cron.sh)\" >>/var/log/update-lxcs-cron.log 2>/dev/null") | crontab -u root -' + clear + echo -e "\n To view Cron Update LXCs logs: cat /var/log/update-lxcs-cron.log" +} + +remove() { + (crontab -l | grep -v "github.com/tteck/Proxmox/raw/main/misc/update-lxcs-cron.sh") | crontab - + rm -rf /var/log/update-lxcs-cron.log + echo "Removed Crontab Schedule from Proxmox VE" +} + +OPTIONS=(Add "Add Crontab Schedule" + Remove "Remove Crontab Schedule") + +CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Cron Update LXCs" --menu "Select an option:" 10 58 2 \ + "${OPTIONS[@]}" 3>&1 1>&2 2>&3) + +case $CHOICE in +"Add") + add + ;; +"Remove") + remove + ;; +*) + echo "Exiting..." + exit 0 + ;; +esac diff --git a/misc/crowdsec.sh b/misc/crowdsec.sh new file mode 100644 index 00000000..12a20f04 --- /dev/null +++ b/misc/crowdsec.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +APP="CrowdSec" +hostname="$(hostname)" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR + +function error_exit() { + trap - ERR + local reason="Unknown failure occured." + local msg="${1:-$reason}" + local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit $EXIT +} +if command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Can't Install on Proxmox "; exit; fi +while true; do + read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +clear +function header_info { + echo -e "${BL} + _____ _ _____ + / ____| | |/ ____| + | | _ __ _____ ____| | (___ ___ ___ + | | | __/ _ \ \ /\ / / _ |\___ \ / _ \/ __| + | |____| | | (_) \ V V / (_| |____) | __/ (__ + \_____|_| \___/ \_/\_/ \__ _|_____/ \___|\___| +${CL}" +} + +header_info + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +msg_info "Setting up ${APP} Repository" +apt-get update &>/dev/null +apt-get install -y curl &>/dev/null +apt-get install -y gnupg &>/dev/null +curl -s https://packagecloud.io/install/repositories/crowdsec/crowdsec/script.deb.sh | bash &>/dev/null +msg_ok "Setup ${APP} Repository" + +msg_info "Installing ${APP}" +apt-get update &>/dev/null +apt-get install -y crowdsec &>/dev/null +msg_ok "Installed ${APP} on $hostname" + +msg_info "Installing ${APP} Common Bouncer" +apt-get install -y crowdsec-firewall-bouncer-iptables &>/dev/null +msg_ok "Installed ${APP} Common Bouncer" + +msg_ok "Completed Successfully!\n" diff --git a/misc/daemonsync_2.2.0.0059_amd64.deb b/misc/daemonsync_2.2.0.0059_amd64.deb new file mode 100644 index 00000000..0444976c Binary files /dev/null and b/misc/daemonsync_2.2.0.0059_amd64.deb differ diff --git a/misc/filebrowser.sh b/misc/filebrowser.sh new file mode 100644 index 00000000..c4cc0e8d --- /dev/null +++ b/misc/filebrowser.sh @@ -0,0 +1,104 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + _______ __ ____ + / ____(_) /__ / __ )_________ _ __________ _____ + / /_ / / / _ \/ __ / ___/ __ \ | /| / / ___/ _ \/ ___/ + / __/ / / / __/ /_/ / / / /_/ / |/ |/ (__ ) __/ / +/_/ /_/_/\___/_____/_/ \____/|__/|__/____/\___/_/ + +EOF +} +IP=$(hostname -I | awk '{print $1}') +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +APP="FileBrowser" +hostname="$(hostname)" +header_info +if [ -f /root/filebrowser.db ]; then + read -r -p "Would you like to uninstall ${APP} on $hostname.? " prompt + if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + systemctl disable -q --now filebrowser.service + rm -rf /usr/local/bin/filebrowser /root/filebrowser.db /etc/systemd/system/filebrowser.service + echo "$APP Removed" + sleep 2 + clear + exit + else + clear + exit + fi +fi +while true; do + read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +header_info +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +read -r -p "Would you like to use No Authentication? " prompt +msg_info "Installing ${APP}" +apt-get install -y curl &>/dev/null +RELEASE=$(curl -fsSL https://api.github.com/repos/filebrowser/filebrowser/releases/latest | grep -o '"tag_name": ".*"' | sed 's/"//g' | sed 's/tag_name: //g') +curl -fsSL https://github.com/filebrowser/filebrowser/releases/download/$RELEASE/linux-amd64-filebrowser.tar.gz | tar -xzv -C /usr/local/bin &>/dev/null + +if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + filebrowser config init -a '0.0.0.0' &>/dev/null + filebrowser config set -a '0.0.0.0' &>/dev/null + filebrowser config init --auth.method=noauth &>/dev/null + filebrowser config set --auth.method=noauth &>/dev/null + filebrowser users add ID 1 --perm.admin &>/dev/null +else + filebrowser config init -a '0.0.0.0' &>/dev/null + filebrowser config set -a '0.0.0.0' &>/dev/null + filebrowser users add admin changeme --perm.admin &>/dev/null +fi +msg_ok "Installed ${APP} on $hostname" + +msg_info "Creating Service" +cat </etc/systemd/system/filebrowser.service +[Unit] +Description=Filebrowser +After=network-online.target + +[Service] +User=root +WorkingDirectory=/root/ +ExecStart=/usr/local/bin/filebrowser -r / + +[Install] +WantedBy=default.target +EOF +systemctl enable -q --now filebrowser.service +msg_ok "Created Service" + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://$IP:8080${CL} \n" diff --git a/misc/frigate-support.sh b/misc/frigate-support.sh new file mode 100644 index 00000000..8dbdc563 --- /dev/null +++ b/misc/frigate-support.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear +cat <<"EOF" + ____ _ __ ____ __ + / __/___(_)__ ____ _/ /____ / __/_ _____ ___ ___ ____/ /_ + / _// __/ / _ `/ _ `/ __/ -_) _\ \/ // / _ \/ _ \/ _ \/ __/ __/ +/_/ /_/ /_/\_, /\_,_/\__/\__/ /___/\_,_/ .__/ .__/\___/_/ \__/ + /___/ /_/ /_/ +EOF +} +header_info +while true; do + read -p "This will Prepare a LXC Container for Frigate. Proceed (y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +header_info + +# The array of device types +# CHAR_DEVS+=(major:minor) +CHAR_DEVS+=("1:1") # mem +CHAR_DEVS+=("29:0") # fb0 +CHAR_DEVS+=("188:.*") # ttyUSB* +CHAR_DEVS+=("189:.*") # bus/usb/* +CHAR_DEVS+=("226:0") # card0 +CHAR_DEVS+=("226:128") # renderD128 + +# Proccess char device string +for char_dev in ${CHAR_DEVS[@]}; do + [ ! -z "${CHAR_DEV_STRING-}" ] && CHAR_DEV_STRING+=" -o" + CHAR_DEV_STRING+=" -regex \".*/${char_dev}\"" +done + +# Store autodev hook script in a variable +read -r -d '' HOOK_SCRIPT <<-EOF || true +for char_dev in \$(find /sys/dev/char -regextype sed $CHAR_DEV_STRING); do + dev="/dev/\$(sed -n "/DEVNAME/ s/^.*=\(.*\)$/\1/p" \${char_dev}/uevent)"; + mkdir -p \$(dirname \${LXC_ROOTFS_MOUNT}\${dev}); + for link in \$(udevadm info --query=property \$dev | sed -n "s/DEVLINKS=//p"); do + mkdir -p \${LXC_ROOTFS_MOUNT}\$(dirname \$link); + cp -dpR \$link \${LXC_ROOTFS_MOUNT}\${link}; + done; + cp -dpR \$dev \${LXC_ROOTFS_MOUNT}\${dev}; +done; +EOF + +# Remove newline char from the variable +HOOK_SCRIPT=${HOOK_SCRIPT//$'\n'/} + +# Generate menu of LXC containers in current node +NODE=$(hostname) +while read -r line; do + TAG=$(echo "$line" | awk '{print $1}') + ITEM=$(echo "$line" | awk '{print substr($0,36)}') + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + CTID_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') + +# Selection menu for LXC containers +while [ -z "${CTID:+x}" ]; do + CTID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Containers on $NODE" --radiolist \ + "\nSelect a container to add support:\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit +done + +# Add autodev settings +CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf +sed '/autodev/d' $CTID_CONFIG_PATH >CTID.conf +cat CTID.conf >$CTID_CONFIG_PATH + +cat <>$CTID_CONFIG_PATH +lxc.autodev: 1 +lxc.hook.autodev: bash -c '$HOOK_SCRIPT' +EOF +echo -e "\e[1;33m \nFinished....Reboot ${CTID} LXC to apply the changes.\n \e[0m" + +# In the Proxmox web shell run +# bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/frigate-support.sh)" +# Reboot the LXC to apply the changes \ No newline at end of file diff --git a/misc/fstrim.sh b/misc/fstrim.sh new file mode 100644 index 00000000..5c0e2ae6 --- /dev/null +++ b/misc/fstrim.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info() { + clear + cat <<"EOF" + _______ __ __ ______ _ + / ____(_) /__ _______ _______/ /____ ____ ___ /_ __/____(_)___ ___ + / /_ / / / _ \/ ___/ / / / ___/ __/ _ \/ __ `__ \ / / / ___/ / __ `__ \ + / __/ / / / __(__ ) /_/ (__ ) /_/ __/ / / / / / / / / / / / / / / / / +/_/ /_/_/\___/____/\__, /____/\__/\___/_/ /_/ /_/ /_/ /_/ /_/_/ /_/ /_/ + /____/ +EOF +} +BL=$(echo "\033[36m") +RD=$(echo "\033[01;31m") +CM='\xE2\x9C\x94\033' +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +header_info +echo "Loading..." + +ROOT_FS=$(df -Th "/" | awk 'NR==2 {print $2}') +if [ "$ROOT_FS" != "ext4" ]; then + echo "Root filesystem is not ext4. Exiting script." + exit 1 +fi + +whiptail --backtitle "Proxmox VE Helper Scripts" --title "Proxmox VE LXC Filesystem Trim" --yesno "The LXC containers will undergo the fstrim command. Proceed?" 10 58 || exit +NODE=$(hostname) +EXCLUDE_MENU=() +MSG_MAX_LENGTH=0 +while read -r TAG ITEM; do + OFFSET=2 + ((${#ITEM} + OFFSET > MSG_MAX_LENGTH)) && MSG_MAX_LENGTH=${#ITEM}+OFFSET + EXCLUDE_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') +excluded_containers=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Containers on $NODE" --checklist "\nSelect containers to skip from trimming:\n" \ + 16 $((MSG_MAX_LENGTH + 23)) 6 "${EXCLUDE_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit + +function trim_container() { + local container=$1 + header_info + echo -e "${BL}[Info]${GN} Trimming ${BL}$container${CL} \n" + local before_trim=$(lvs | awk -F '[[:space:]]+' 'NR>1 && (/Data%|'"vm-$container"'/) {gsub(/%/, "", $7); print $7}') + echo -e "${RD}Data before trim $before_trim%${CL}" + pct fstrim $container + local after_trim=$(lvs | awk -F '[[:space:]]+' 'NR>1 && (/Data%|'"vm-$container"'/) {gsub(/%/, "", $7); print $7}') + echo -e "${GN}Data after trim $after_trim%${CL}" + sleep 1.5 +} + + + +for container in $(pct list | awk '{if(NR>1) print $1}'); do + if [[ " ${excluded_containers[@]} " =~ " $container " ]]; then + header_info + echo -e "${BL}[Info]${GN} Skipping ${BL}$container${CL}" + sleep 1 + else + template=$(pct config $container | grep -q "template:" && echo "true" || echo "false") + if [ "$template" == "true" ]; then + header_info + echo -e "${BL}[Info]${GN} Skipping ${container} ${RD}$container is a template ${CL} \n" + sleep 1 + continue + fi + trim_container $container + fi +done + +wait +header_info +echo -e "${GN} Finished, LXC Containers Trimmed. ${CL} \n" diff --git a/misc/glances.sh b/misc/glances.sh new file mode 100644 index 00000000..31840977 --- /dev/null +++ b/misc/glances.sh @@ -0,0 +1,125 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + ________ + / ____/ /___ _____ ________ _____ + / / __/ / __ `/ __ \/ ___/ _ \/ ___/ +/ /_/ / / /_/ / / / / /__/ __(__ ) +\____/_/\__,_/_/ /_/\___/\___/____/ + +EOF +} +IP=$(hostname -I | awk '{print $1}') +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD=" " +CM="${GN}✓${CL}" +APP="Glances" +hostname="$(hostname)" +silent() { "$@" >/dev/null 2>&1; } +set -e +spinner() { + local chars="/-\|" + local spin_i=0 + printf "\e[?25l" + while true; do + printf "\r \e[36m%s\e[0m" "${chars:spin_i++%${#chars}:1}" + sleep 0.1 + done +} + +msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg} " + spinner & + SPINNER_PID=$! +} + +msg_ok() { + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + printf "\e[?25h" + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +install() { + header_info + while true; do + read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac + done + header_info + read -r -p "Verbose mode? " prompt + if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + STD="" + else + STD="silent" + fi + msg_info "Installing $APP" + rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED + $STD bash -c "$(wget -qLO - https://raw.githubusercontent.com/nicolargo/glancesautoinstall/master/install.sh)" + cat </etc/systemd/system/glances.service +[Unit] +Description=Glances - An eye on your system +After=network.target + +[Service] +Type=simple +ExecStart=/usr/local/bin/glances -w +Restart=on-failure + +[Install] +WantedBy=multi-user.target +EOF + systemctl enable -q --now glances.service + msg_ok "Installed $APP on $hostname" + + echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://$IP:61208${CL} \n" +} +uninstall() { + header_info + msg_info "Uninstalling $APP" + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + systemctl disable -q --now glances + bash -c "$(wget -qLO - https://raw.githubusercontent.com/nicolargo/glancesautoinstall/master/uninstall.sh)" + rm -rf /etc/systemd/system/glances.service + msg_ok "Uninstalled $APP" + msg_ok "Completed Successfully!\n" +} + +OPTIONS=(Install "Install $APP" \ + Uninstall "Uninstall $APP") + +CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "$APP" --menu "Select an option:" 10 58 2 \ + "${OPTIONS[@]}" 3>&1 1>&2 2>&3) + +case $CHOICE in + "Install") + install + ;; + "Uninstall") + uninstall + ;; + *) + echo "Exiting..." + exit 0 + ;; +esac diff --git a/misc/host-backup.sh b/misc/host-backup.sh new file mode 100644 index 00000000..31b67bfa --- /dev/null +++ b/misc/host-backup.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + __ __ __ ___ __ + / // /__ ___ / /_ / _ )___ _____/ /____ _____ + / _ / _ \(_-&1 1>&2 2>&3) || return + + # Default to /root/ if no input + BACKUP_PATH="${BACKUP_PATH:-/root/}" + + # Get directory to work in from user + DIR=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "\nDefaults to /etc/\ne.g. /root/, /var/lib/pve-cluster/ etc." 11 68 --title "Directory to work in:" 3>&1 1>&2 2>&3) || return + + # Default to /etc/ if no input + DIR="${DIR:-/etc/}" + + DIR_DASH=$(echo "$DIR" | tr '/' '-') + BACKUP_FILE="$(hostname)${DIR_DASH}backup" + + # Build a list of directories for backup + local CTID_MENU=() + while read -r dir; do + CTID_MENU+=("$(basename "$dir")" "$dir " "OFF") + done < <(ls -d "${DIR}"*) + + # Allow the user to select directories + local HOST_BACKUP + while [ -z "${HOST_BACKUP:+x}" ]; do + HOST_BACKUP=$(whiptail --backtitle "Proxmox VE Host Backup" --title "Working in the ${DIR} directory " --checklist \ + "\nSelect what files/directories to backup:\n" 16 $(((${#DIRNAME} + 2) + 88)) 6 "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || return + + for selected_dir in ${HOST_BACKUP//\"/}; do + selected_directories+=("${DIR}$selected_dir") + done + done + + # Perform the backup + header_info + echo -e "This will create a backup in\e[1;33m $BACKUP_PATH \e[0mfor these files and directories\e[1;33m ${selected_directories[*]} \e[0m" + read -p "Press ENTER to continue..." + header_info + echo "Working..." + tar -czf "$BACKUP_PATH$BACKUP_FILE-$(date +%Y_%m_%d).tar.gz" --absolute-names "${selected_directories[@]}" + header_info + echo -e "\nFinished" + echo -e "\e[1;33m \nA backup is rendered ineffective when it remains stored on the host.\n \e[0m" + sleep 2 +} + +# Main script execution loop +while true; do + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "Proxmox VE Host Backup" --yesno "This will create backups for particular files and directories located within a designated directory. Proceed?" 10 88); then + perform_backup + else + break + fi +done diff --git a/misc/hw-acceleration.sh b/misc/hw-acceleration.sh new file mode 100644 index 00000000..19a0b140 --- /dev/null +++ b/misc/hw-acceleration.sh @@ -0,0 +1,116 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +# Execute within the Proxmox shell +# bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/hw-acceleration.sh)" + +set -e +function header_info { + clear + cat <<"EOF" + + __ ___ __ ___ __ __ _ + / // / | /| / / / _ |___________ / /__ _______ _/ /_(_)__ ___ + / _ /| |/ |/ / / __ / __/ __/ -_) / -_) __/ _ `/ __/ / _ \/ _ \ +/_//_/ |__/|__/ /_/ |_\__/\__/\__/_/\__/_/ \_,_/\__/_/\___/_//_/ + +EOF +} + +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +RD=$(echo "\033[01;31m") +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +set -e +header_info +echo "Loading..." +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +if ! pveversion | grep -Eq "pve-manager/(8\.[1-3])"; then + msg_error "This version of Proxmox Virtual Environment is not supported" + echo -e "Requires PVE Version 8.1 or higher" + echo -e "Exiting..." + sleep 2 + exit +fi + +whiptail --backtitle "Proxmox VE Helper Scripts" --title "Add Intel HW Acceleration" --yesno "This Will Add Intel HW Acceleration to an existing LXC Container. Proceed?" 8 72 || exit +NODE=$(hostname) +PREV_MENU=() +MSG_MAX_LENGTH=0 +privileged_containers=$(pct list | awk 'NR>1 && system("grep -q \047unprivileged: 1\047 /etc/pve/lxc/" $1 ".conf")') + +if [ -z "$privileged_containers" ]; then + whiptail --msgbox "No Privileged Containers Found." 10 58 + exit +fi + +while read -r TAG ITEM; do + OFFSET=2 + ((${#ITEM} + OFFSET > MSG_MAX_LENGTH)) && MSG_MAX_LENGTH=${#ITEM}+OFFSET + PREV_MENU+=("$TAG" "$ITEM " "OFF") +done < <(echo "$privileged_containers") + +privileged_container=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Privileged Containers on $NODE" --checklist "\nSelect a Container To Add Intel HW Acceleration:\n" 16 $((MSG_MAX_LENGTH + 23)) 6 "${PREV_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit +header_info +read -r -p "Verbose mode? " prompt + if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + STD="" + else + STD="silent" + fi +header_info + +cat <>/etc/pve/lxc/${privileged_container}.conf +lxc.cgroup2.devices.allow: c 226:0 rwm +lxc.cgroup2.devices.allow: c 226:128 rwm +lxc.cgroup2.devices.allow: c 29:0 rwm +lxc.mount.entry: /dev/fb0 dev/fb0 none bind,optional,create=file +lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir +lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file +EOF + +read -r -p "Do you need the intel-media-va-driver-non-free driver (Debian 12 only)? " prompt +if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + header_info + msg_info "Installing Hardware Acceleration (non-free)" + pct exec ${privileged_container} -- bash -c "cat </etc/apt/sources.list.d/non-free.list + +deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware +deb-src http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware + +deb http://deb.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware +deb-src http://deb.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware + +deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware +deb-src http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware +EOF" + + pct exec ${privileged_container} -- bash -c "silent() { \"\$@\" >/dev/null 2>&1; } && $STD apt-get update && $STD apt-get install -y intel-media-va-driver-non-free ocl-icd-libopencl1 intel-opencl-icd vainfo intel-gpu-tools && $STD adduser \$(id -u -n) video && $STD adduser \$(id -u -n) render" + msg_ok "Installed Hardware Acceleration (non-free)" +else + header_info + msg_info "Installing Hardware Acceleration" + pct exec ${privileged_container} -- bash -c "silent() { \"\$@\" >/dev/null 2>&1; } && $STD apt-get install -y va-driver-all ocl-icd-libopencl1 intel-opencl-icd vainfo intel-gpu-tools && chgrp video /dev/dri && chmod 755 /dev/dri && $STD adduser \$(id -u -n) video && $STD adduser \$(id -u -n) render" + msg_ok "Installed Hardware Acceleration" +fi +sleep 1 +whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Added tools" "vainfo, execute command 'vainfo'\nintel-gpu-tools, execute command 'intel_gpu_top'" 8 58 + +msg_ok "Completed Successfully!\n" +echo -e "Reboot container ${BL}$privileged_container${CL} to apply the new settings\n" diff --git a/misc/images/cpu.png b/misc/images/cpu.png new file mode 100644 index 00000000..cbd8207c Binary files /dev/null and b/misc/images/cpu.png differ diff --git a/misc/images/daemon-sync.png b/misc/images/daemon-sync.png new file mode 100644 index 00000000..c8ed9c5a Binary files /dev/null and b/misc/images/daemon-sync.png differ diff --git a/misc/images/filebrowser.png b/misc/images/filebrowser.png new file mode 100644 index 00000000..0c250d0a Binary files /dev/null and b/misc/images/filebrowser.png differ diff --git a/misc/images/haos.png b/misc/images/haos.png new file mode 100644 index 00000000..4fce16eb Binary files /dev/null and b/misc/images/haos.png differ diff --git a/misc/images/heimdall.png b/misc/images/heimdall.png new file mode 100644 index 00000000..46c6bfb1 Binary files /dev/null and b/misc/images/heimdall.png differ diff --git a/misc/images/logo-81x112.png b/misc/images/logo-81x112.png new file mode 100644 index 00000000..04bcb8d1 Binary files /dev/null and b/misc/images/logo-81x112.png differ diff --git a/misc/images/logo.png b/misc/images/logo.png new file mode 100644 index 00000000..1d2186da Binary files /dev/null and b/misc/images/logo.png differ diff --git a/misc/images/monitor.png b/misc/images/monitor.png new file mode 100644 index 00000000..8b280dfd Binary files /dev/null and b/misc/images/monitor.png differ diff --git a/misc/images/nocodb.png b/misc/images/nocodb.png new file mode 100644 index 00000000..269f74ac Binary files /dev/null and b/misc/images/nocodb.png differ diff --git a/misc/images/openobsecure.png b/misc/images/openobsecure.png new file mode 100644 index 00000000..52bbc970 Binary files /dev/null and b/misc/images/openobsecure.png differ diff --git a/misc/images/photoprism.png b/misc/images/photoprism.png new file mode 100644 index 00000000..736014d4 Binary files /dev/null and b/misc/images/photoprism.png differ diff --git a/misc/images/pimox.png b/misc/images/pimox.png new file mode 100644 index 00000000..a6a8baed Binary files /dev/null and b/misc/images/pimox.png differ diff --git a/misc/images/processor.png b/misc/images/processor.png new file mode 100644 index 00000000..75af60a9 Binary files /dev/null and b/misc/images/processor.png differ diff --git a/misc/images/whoogle.png b/misc/images/whoogle.png new file mode 100644 index 00000000..9a6a997c Binary files /dev/null and b/misc/images/whoogle.png differ diff --git a/misc/install.func b/misc/install.func new file mode 100644 index 00000000..660ea2c4 --- /dev/null +++ b/misc/install.func @@ -0,0 +1,203 @@ +# This function sets color variables for formatting output in the terminal +color() { + YW=$(echo "\033[33m") + BL=$(echo "\033[36m") + RD=$(echo "\033[01;31m") + BGN=$(echo "\033[4;92m") + GN=$(echo "\033[1;92m") + DGN=$(echo "\033[32m") + CL=$(echo "\033[m") + RETRY_NUM=10 + RETRY_EVERY=3 + CM="${GN}✓${CL}" + CROSS="${RD}✗${CL}" + BFR="\\r\\033[K" + HOLD=" " +} + +# This function enables IPv6 if it's not disabled and sets verbose mode if the global variable is set to "yes" +verb_ip6() { + if [ "$VERBOSE" = "yes" ]; then + STD="" + else STD="silent"; fi + silent() { "$@" >/dev/null 2>&1; } + if [ "$DISABLEIPV6" == "yes" ]; then + echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf + $STD sysctl -p + fi +} + +# This function sets error handling options and defines the error_handler function to handle errors +catch_errors() { + set -Eeuo pipefail + trap 'error_handler $LINENO "$BASH_COMMAND"' ERR +} + +# This function handles errors +error_handler() { + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + printf "\e[?25h" + local exit_code="$?" + local line_number="$1" + local command="$2" + local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" + echo -e "\n$error_message" + if [[ "$line_number" -eq 23 ]]; then + echo -e "The silent function has suppressed the error, run the script with verbose mode enabled, which will provide more detailed output.\n" + fi +} + +# This function displays a spinner. +spinner() { + local chars="/-\|" + local spin_i=0 + printf "\e[?25l" + while true; do + printf "\r \e[36m%s\e[0m" "${chars:spin_i++%${#chars}:1}" + sleep 0.1 + done +} + +# This function displays an informational message with a yellow color. +msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg} " + spinner & + SPINNER_PID=$! +} + + +# This function displays a success message with a green color. +msg_ok() { + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + printf "\e[?25h" + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +# This function displays a error message with a red color. +msg_error() { + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + printf "\e[?25h" + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +# This function sets up the Container OS by generating the locale, setting the timezone, and checking the network connection +setting_up_container() { + msg_info "Setting up Container OS" + sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen + locale_line=$(grep -v '^#' /etc/locale.gen | grep -E '^[a-zA-Z]' | awk '{print $1}' | head -n 1) + echo "LANG=${locale_line}" >/etc/default/locale + locale-gen >/dev/null + export LANG=${locale_line} + echo $tz >/etc/timezone + ln -sf /usr/share/zoneinfo/$tz /etc/localtime + for ((i = RETRY_NUM; i > 0; i--)); do + if [ "$(hostname -I)" != "" ]; then + break + fi + echo 1>&2 -en "${CROSS}${RD} No Network! " + sleep $RETRY_EVERY + done + if [ "$(hostname -I)" = "" ]; then + echo 1>&2 -e "\n${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}" + echo -e " 🖧 Check Network Settings" + exit 1 + fi + rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED + systemctl disable -q --now systemd-networkd-wait-online.service + msg_ok "Set up Container OS" + msg_ok "Network Connected: ${BL}$(hostname -I)" +} + +# This function checks the network connection by pinging a known IP address and prompts the user to continue if the internet is not connected +network_check() { + set +e + trap - ERR + ipv4_connected=false + ipv6_connected=false + +# Check IPv4 connectivity + if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then + msg_ok "IPv4 Internet Connected"; + ipv4_connected=true + else + msg_error "IPv4 Internet Not Connected"; + fi + +# Check IPv6 connectivity + if ping6 -c 1 -W 1 2606:4700:4700::1111 &>/dev/null; then + msg_ok "IPv6 Internet Connected"; + ipv6_connected=true + else + msg_error "IPv6 Internet Not Connected"; + fi + +# If both IPv4 and IPv6 checks fail, prompt the user + if [[ $ipv4_connected == false && $ipv6_connected == false ]]; then + read -r -p "No Internet detected,would you like to continue anyway? " prompt + if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + echo -e " ⚠️ ${RD}Expect Issues Without Internet${CL}" + else + echo -e " 🖧 Check Network Settings" + exit 1 + fi + fi + + RESOLVEDIP=$(getent hosts github.com | awk '{ print $1 }') + if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved github.com to ${BL}$RESOLVEDIP${CL}"; fi + set -e + trap 'error_handler $LINENO "$BASH_COMMAND"' ERR +} + +# This function updates the Container OS by running apt-get update and upgrade +update_os() { + msg_info "Updating Container OS" + if [[ "$CACHER" == "yes" ]]; then + echo "Acquire::http::Proxy-Auto-Detect \"/usr/local/bin/apt-proxy-detect.sh\";" >/etc/apt/apt.conf.d/00aptproxy + cat </usr/local/bin/apt-proxy-detect.sh +#!/bin/bash +if nc -w1 -z "${CACHER_IP}" 3142; then + echo -n "http://${CACHER_IP}:3142" +else + echo -n "DIRECT" +fi +EOF + chmod +x /usr/local/bin/apt-proxy-detect.sh + fi + $STD apt-get update + $STD apt-get -o Dpkg::Options::="--force-confold" -y dist-upgrade + rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED + msg_ok "Updated Container OS" +} + +# This function modifies the message of the day (motd) and SSH settings +motd_ssh() { + echo "export TERM='xterm-256color'" >>/root/.bashrc + echo -e "$APPLICATION LXC provided by https://helper-scripts.com/\n" >/etc/motd + chmod -x /etc/update-motd.d/* + if [[ "${SSH_ROOT}" == "yes" ]]; then + sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config + systemctl restart sshd + fi +} + +# This function customizes the container by modifying the getty service and enabling auto-login for the root user +customize() { + if [[ "$PASSWORD" == "" ]]; then + msg_info "Customizing Container" + GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf" + mkdir -p $(dirname $GETTY_OVERRIDE) + cat <$GETTY_OVERRIDE + [Service] + ExecStart= + ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM +EOF + systemctl daemon-reload + systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') + msg_ok "Customized Container" + fi + echo "bash -c \"\$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/${app}.sh)\"" >/usr/bin/update + chmod +x /usr/bin/update +} diff --git a/misc/kernel-clean.sh b/misc/kernel-clean.sh new file mode 100644 index 00000000..ca31cc2f --- /dev/null +++ b/misc/kernel-clean.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + __ __ __ ________ + / //_/__ _________ ___ / / / ____/ /__ ____ _____ + / ,< / _ \/ ___/ __ \/ _ \/ / / / / / _ \/ __ `/ __ \ + / /| / __/ / / / / / __/ / / /___/ / __/ /_/ / / / / +/_/ |_\___/_/ /_/ /_/\___/_/ \____/_/\___/\__,_/_/ /_/ + +EOF +} +YW=$(echo "\033[33m") +RD=$(echo "\033[01;31m") +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +current_kernel=$(uname -r) +available_kernels=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print $2}' | grep -v "$current_kernel" | sort -V) +header_info + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +whiptail --backtitle "Proxmox VE Helper Scripts" --title "Proxmox VE Kernel Clean" --yesno "This will Clean Unused Kernel Images, USE AT YOUR OWN RISK. Proceed?" 10 68 || exit +if [ -z "$available_kernels" ]; then + whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Old Kernels" --msgbox "It appears there are no old Kernels on your system. \nCurrent kernel ($current_kernel)." 10 68 + echo "Exiting..." + sleep 2 + clear + exit +fi + KERNEL_MENU=() + MSG_MAX_LENGTH=0 +while read -r TAG ITEM; do + OFFSET=2 + ((${#ITEM} + OFFSET > MSG_MAX_LENGTH)) && MSG_MAX_LENGTH=${#ITEM}+OFFSET + KERNEL_MENU+=("$TAG" "$ITEM " "OFF") +done < <(echo "$available_kernels") + +remove_kernels=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Current Kernel $current_kernel" --checklist "\nSelect Kernels to remove:\n" 16 $((MSG_MAX_LENGTH + 58)) 6 "${KERNEL_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit +[ -z "$remove_kernels" ] && { + whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Kernel Selected" --msgbox "It appears that no Kernel was selected" 10 68 + echo "Exiting..." + sleep 2 + clear + exit +} +whiptail --backtitle "Proxmox VE Helper Scripts" --title "Remove Kernels" --yesno "Would you like to remove the $(echo $remove_kernels | awk '{print NF}') previously selected Kernels?" 10 68 || exit + +msg_info "Removing ${CL}${RD}$(echo $remove_kernels | awk '{print NF}') ${CL}${YW}old Kernels${CL}" +/usr/bin/apt purge -y $remove_kernels >/dev/null 2>&1 +msg_ok "Successfully Removed Kernels" + +msg_info "Updating GRUB" +/usr/sbin/update-grub >/dev/null 2>&1 +msg_ok "Successfully Updated GRUB" +msg_info "Exiting" +sleep 2 +msg_ok "Finished" diff --git a/misc/kernel-pin.sh b/misc/kernel-pin.sh new file mode 100644 index 00000000..a2a15ede --- /dev/null +++ b/misc/kernel-pin.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + __ __ __ ____ _ + / //_/__ _________ ___ / / / __ \(_)___ + / ,< / _ \/ ___/ __ \/ _ \/ / / /_/ / / __ \ + / /| / __/ / / / / / __/ / / ____/ / / / / +/_/ |_\___/_/ /_/ /_/\___/_/ /_/ /_/_/ /_/ + +EOF +} +YW=$(echo "\033[33m") +RD=$(echo "\033[01;31m") +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +current_kernel=$(uname -r) +available_kernels=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print substr($2, 16, length($2)-22)}') +header_info + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +whiptail --backtitle "Proxmox VE Helper Scripts" --title "Proxmox VE Kernel Pin" --yesno "This will Pin/Unpin Kernel Images, Proceed?" 10 68 || exit + + KERNEL_MENU=() + MSG_MAX_LENGTH=0 +while read -r TAG ITEM; do + OFFSET=2 + ((${#ITEM} + OFFSET > MSG_MAX_LENGTH)) && MSG_MAX_LENGTH=${#ITEM}+OFFSET + KERNEL_MENU+=("$TAG" "$ITEM " "OFF") +done < <(echo "$available_kernels") + +pin_kernel=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Current Kernel $current_kernel" --radiolist "\nSelect Kernel to pin:\nCancel to Unpin any Kernel" 16 $((MSG_MAX_LENGTH + 58)) 6 "${KERNEL_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit +[ -z "$pin_kernel" ] && { + whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Kernel Selected" --msgbox "It appears that no Kernel was selected\nUnpinning any pinned Kernel" 10 68 + msg_info "Unpinning any Kernel" + proxmox-boot-tool kernel unpin &>/dev/null + msg_ok "Unpinned any Kernel\n" + proxmox-boot-tool kernel list + echo "" + msg_ok "Finished\n" + echo -e "${RD} REBOOT${CL}" + exit +} +whiptail --backtitle "Proxmox VE Helper Scripts" --title "Proxmox VE Kernel Pin" --yesno "Would you like to pin the $pin_kernel Kernel?" 10 68 || exit + +msg_info "Pinning $pin_kernel" +proxmox-boot-tool kernel pin $pin_kernel &>/dev/null +msg_ok "Successfully Pinned $pin_kernel\n" +proxmox-boot-tool kernel list +echo "" +msg_ok "Finished\n" +echo -e "${RD} REBOOT${CL}" diff --git a/misc/microcode.sh b/misc/microcode.sh new file mode 100644 index 00000000..44ad9b54 --- /dev/null +++ b/misc/microcode.sh @@ -0,0 +1,125 @@ +#!/usr/bin/env bash +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + ____ __ ____ __ + / __ \_________ ________ ______________ _____ / |/ (_)_____________ _________ ____/ /__ + / /_/ / ___/ __ \/ ___/ _ \/ ___/ ___/ __ \/ ___/ / /|_/ / / ___/ ___/ __ \/ ___/ __ \/ __ / _ \ + / ____/ / / /_/ / /__/ __(__ |__ ) /_/ / / / / / / / /__/ / / /_/ / /__/ /_/ / /_/ / __/ +/_/ /_/ \____/\___/\___/____/____/\____/_/ /_/ /_/_/\___/_/ \____/\___/\____/\__,_/\___/ + +EOF +} + +RD=$(echo "\033[01;31m") +YW=$(echo "\033[33m") +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" + +msg_info() { echo -ne " ${HOLD} ${YW}$1..."; } +msg_ok() { echo -e "${BFR} ${CM} ${GN}$1${CL}"; } +msg_error() { echo -e "${BFR} ${CROSS} ${RD}$1${CL}"; } + +header_info +current_microcode=$(journalctl -k | grep -i 'microcode: Current revision:' | grep -oP 'Current revision: \K0x[0-9a-f]+') +[ -z "$current_microcode" ] && current_microcode="Not found." + +intel() { + if ! dpkg -s iucode-tool >/dev/null 2>&1; then + msg_info "Installing iucode-tool (Intel microcode updater)" + apt-get install -y iucode-tool &>/dev/null + msg_ok "Installed iucode-tool" + else + msg_ok "Intel iucode-tool is already installed" + sleep 1 + fi + + intel_microcode=$(curl -fsSL "https://ftp.debian.org/debian/pool/non-free-firmware/i/intel-microcode//" | grep -o 'href="[^"]*amd64.deb"' | sed 's/href="//;s/"//') + [ -z "$intel_microcode" ] && { whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Microcode Found" --msgbox "It appears there were no microcode packages found\n Try again later." 10 68; msg_info "Exiting"; sleep 1; msg_ok "Done"; exit; } + + MICROCODE_MENU=() + MSG_MAX_LENGTH=0 + + while read -r TAG ITEM; do + OFFSET=2 + (( ${#ITEM} + OFFSET > MSG_MAX_LENGTH )) && MSG_MAX_LENGTH=${#ITEM}+OFFSET + MICROCODE_MENU+=("$TAG" "$ITEM " "OFF") + done < <(echo "$intel_microcode") + + microcode=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Current Microcode revision:${current_microcode}" --radiolist "\nSelect a microcode package to install:\n" 16 $((MSG_MAX_LENGTH + 58)) 6 "${MICROCODE_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit + + [ -z "$microcode" ] && { whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Microcode Selected" --msgbox "It appears that no microcode packages were selected" 10 68; msg_info "Exiting"; sleep 1; msg_ok "Done"; exit; } + + msg_info "Downloading the Intel Processor Microcode Package $microcode" + wget -q http://ftp.debian.org/debian/pool/non-free-firmware/i/intel-microcode/$microcode + msg_ok "Downloaded the Intel Processor Microcode Package $microcode" + + msg_info "Installing $microcode (Patience)" + dpkg -i $microcode &>/dev/null + msg_ok "Installed $microcode" + + msg_info "Cleaning up" + rm $microcode + msg_ok "Cleaned" + echo -e "\nIn order to apply the changes, a system reboot will be necessary.\n" +} + +amd() { + amd_microcode=$(curl -fsSL "https://ftp.debian.org/debian/pool/non-free-firmware/a/amd64-microcode///" | grep -o 'href="[^"]*amd64.deb"' | sed 's/href="//;s/"//') + + [ -z "$amd_microcode" ] && { whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Microcode Found" --msgbox "It appears there were no microcode packages found\n Try again later." 10 68; msg_info "Exiting"; sleep 1; msg_ok "Done"; exit; } + + MICROCODE_MENU=() + MSG_MAX_LENGTH=0 + + while read -r TAG ITEM; do + OFFSET=2 + (( ${#ITEM} + OFFSET > MSG_MAX_LENGTH )) && MSG_MAX_LENGTH=${#ITEM}+OFFSET + MICROCODE_MENU+=("$TAG" "$ITEM " "OFF") + done < <(echo "$amd_microcode") + + microcode=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Current Microcode revision:${current_microcode}" --radiolist "\nSelect a microcode package to install:\n" 16 $((MSG_MAX_LENGTH + 58)) 6 "${MICROCODE_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit + + [ -z "$microcode" ] && { whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Microcode Selected" --msgbox "It appears that no microcode packages were selected" 10 68; msg_info "Exiting"; sleep 1; msg_ok "Done"; exit; } + + msg_info "Downloading the AMD Processor Microcode Package $microcode" + wget -q https://ftp.debian.org/debian/pool/non-free-firmware/a/amd64-microcode/$microcode + msg_ok "Downloaded the AMD Processor Microcode Package $microcode" + + msg_info "Installing $microcode (Patience)" + dpkg -i $microcode &>/dev/null + msg_ok "Installed $microcode" + + msg_info "Cleaning up" + rm $microcode + msg_ok "Cleaned" + echo -e "\nIn order to apply the changes, a system reboot will be necessary.\n" +} + +if ! command -v pveversion >/dev/null 2>&1; then header_info; msg_error "No PVE Detected!"; exit; fi + +whiptail --backtitle "Proxmox VE Helper Scripts" --title "Proxmox VE Processor Microcode" --yesno "This will check for CPU microcode packages with the option to install. Proceed?" 10 58 || exit + +msg_info "Checking CPU Vendor" +cpu=$(lscpu | grep -oP 'Vendor ID:\s*\K\S+' | head -n 1) +if [ "$cpu" == "GenuineIntel" ]; then + msg_ok "${cpu} was detected" + sleep 1 + intel +elif [ "$cpu" == "AuthenticAMD" ]; then + msg_ok "${cpu} was detected" + sleep 1 + amd +else + msg_error "${cpu} is not supported" + exit +fi diff --git a/misc/monitor-all.sh b/misc/monitor-all.sh new file mode 100644 index 00000000..79bf0df0 --- /dev/null +++ b/misc/monitor-all.sh @@ -0,0 +1,163 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +clear +cat <<"EOF" + __ ___ _ __ ___ ____ + / |/ /___ ____ (_) /_____ _____ / | / / / + / /|_/ / __ \/ __ \/ / __/ __ \/ ___/ / /| | / / / + / / / / /_/ / / / / / /_/ /_/ / / / ___ |/ / / +/_/ /_/\____/_/ /_/_/\__/\____/_/ /_/ |_/_/_/ + +EOF + +add() { +while true; do + read -p "This script will add Monitor All to Proxmox VE. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done + +echo '#!/usr/bin/env bash +# Read excluded instances from command line arguments +excluded_instances=("$@") +echo "Excluded instances: ${excluded_instances[@]}" + +while true; do + + for instance in $(pct list | awk '\''{if(NR>1) print $1}'\''; qm list | awk '\''{if(NR>1) print $1}'\''); do + # Skip excluded instances + if [[ " ${excluded_instances[@]} " =~ " ${instance} " ]]; then + echo "Skipping $instance because it is excluded" + continue + fi + + # Determine the type of the instance (container or virtual machine) + if pct status $instance >/dev/null 2>&1; then + # It is a container + config_cmd="pct config" + IP=$(pct exec $instance ip a s dev eth0 | awk '\''/inet / {print $2}'\'' | cut -d/ -f1) + else + # It is a virtual machine + config_cmd="qm config" + IP=$(qm guest cmd $instance network-get-interfaces | egrep -o "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -E "192\.|10\." | head -n 1) + fi + + # Skip instances based on onboot and templates + onboot=$($config_cmd $instance | grep -q "onboot: 0" || ( ! $config_cmd $instance | grep -q "onboot" ) && echo "true" || echo "false") + template=$($config_cmd $instance | grep template | grep -q "template:" && echo "true" || echo "false") + + if [ "$onboot" == "true" ]; then + echo "Skipping $instance because it is set not to boot" + continue + elif [ "$template" == "true" ]; then + echo "Skipping $instance because it is a template" + continue + fi + + # Ping the instance + if ! ping -c 1 $IP >/dev/null 2>&1; then + # If the instance can not be pinged, stop and start it + if pct status $instance >/dev/null 2>&1; then + # It is a container + echo "$(date): CT $instance is not responding, restarting..." + pct stop $instance >/dev/null 2>&1 + sleep 5 + pct start $instance >/dev/null 2>&1 + else + # It is a virtual machine + if qm status $instance | grep -q "status: running"; then + echo "$(date): VM $instance is not responding, restarting..." + qm stop $instance >/dev/null 2>&1 + sleep 5 + else + echo "$(date): VM $instance is not running, starting..." + fi + qm start $instance >/dev/null 2>&1 + fi + fi + done + + # Wait for 5 minutes. (Edit to your needs) + echo "$(date): Pausing for 5 minutes..." + sleep 300 +done >/var/log/ping-instances.log 2>&1' >/usr/local/bin/ping-instances.sh +touch /var/log/ping-instances.log +# Change file permissions to executable +chmod +x /usr/local/bin/ping-instances.sh +cat </etc/systemd/system/ping-instances.timer +[Unit] +Description=Delay ping-instances.service by 5 minutes + +[Timer] +OnBootSec=300 +OnUnitActiveSec=300 + +[Install] +WantedBy=timers.target +EOF + +# Create ping-instances.service +cat </etc/systemd/system/ping-instances.service +[Unit] +Description=Ping instances every 5 minutes and restarts if necessary +After=ping-instances.timer +Requires=ping-instances.timer +[Service] +Type=simple +# To specify which CT/VM should be excluded, add the CT/VM ID at the end of the line where ExecStart=/usr/local/bin/ping-instances.sh is specified. +# For example: ExecStart=/usr/local/bin/ping-instances.sh 100 102 +# Virtual machines without the QEMU guest agent installed must be excluded. + +ExecStart=/usr/local/bin/ping-instances.sh +Restart=always +StandardOutput=file:/var/log/ping-instances.log +StandardError=file:/var/log/ping-instances.log + +[Install] +WantedBy=multi-user.target +EOF + +# Reload daemon, enable and start ping-instances.service +systemctl daemon-reload +systemctl enable -q --now ping-instances.timer +systemctl enable -q --now ping-instances.service +clear +echo -e "\n To view Monitor All logs: cat /var/log/ping-instances.log" +} + +remove() { + systemctl disable -q --now ping-instances.timer + systemctl disable -q --now ping-instances.service + rm /etc/systemd/system/ping-instances.service /etc/systemd/system/ping-instances.timer /usr/local/bin/ping-instances.sh /var/log/ping-instances.log + echo "Removed Monitor All from Proxmox VE" +} + +# Define options for the whiptail menu +OPTIONS=(Add "Add Monitor-All to Proxmox VE" \ + Remove "Remove Monitor-All from Proxmox VE") + +# Show the whiptail menu and save the user's choice +CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Monitor-All for Proxmox VE" --menu "Select an option:" 10 58 2 \ + "${OPTIONS[@]}" 3>&1 1>&2 2>&3) + +# Check the user's choice and perform the corresponding action +case $CHOICE in + "Add") + add + ;; + "Remove") + remove + ;; + *) + echo "Exiting..." + exit 0 + ;; +esac diff --git a/misc/netdata.sh b/misc/netdata.sh new file mode 100644 index 00000000..885cd42d --- /dev/null +++ b/misc/netdata.sh @@ -0,0 +1,122 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + _ __ __ ____ __ + / | / /__ / /_/ __ \____ _/ /_____ _ + / |/ / _ \/ __/ / / / __ `/ __/ __ `/ + / /| / __/ /_/ /_/ / /_/ / /_/ /_/ / +/_/ |_/\___/\__/_____/\__,_/\__/\__,_/ + +EOF +} + +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +RD=$(echo "\033[01;31m") +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +silent() { "$@" >/dev/null 2>&1; } +set -e +header_info +echo "Loading..." +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +install() { + header_info + while true; do + read -p "Are you sure you want to install NetData on Proxmox VE host. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac + done + header_info + read -r -p "Verbose mode? " prompt + if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + STD="" + else + STD="silent" + fi + header_info + + msg_info "Setting up repository" + wget -q https://repo.netdata.cloud/repos/repoconfig/debian/bookworm/netdata-repo_2-2+debian12_all.deb + $STD dpkg -i netdata-repo_2-2+debian12_all.deb + rm -rf netdata-repo_2-2+debian12_all.deb + msg_ok "Set up repository" + + msg_info "Installing Netdata" + $STD apt-get update + $STD apt-get install -y netdata + msg_ok "Installed Netdata" + msg_ok "Completed Successfully!\n" + echo -e "\n Netdata should be reachable at${BL} http://$(hostname -I | awk '{print $1}'):19999 ${CL}\n" +} + +uninstall() { + header_info + read -r -p "Verbose mode? " prompt + if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + STD="" + else + STD="silent" + fi + header_info + + msg_info "Uninstalling Netdata" + systemctl stop netdata + rm -rf /var/log/netdata /var/lib/netdata /var/cache/netdata /etc/netdata/go.d + rm -rf /etc/apt/trusted.gpg.d/netdata-archive-keyring.gpg /etc/apt/sources.list.d/netdata.list + $STD apt-get remove --purge -y netdata netdata-repo + systemctl daemon-reload + $STD apt autoremove -y + $STD userdel netdata + msg_ok "Uninstalled Netdata" + msg_ok "Completed Successfully!\n" +} + +if ! pveversion | grep -Eq "pve-manager/(8\.[0-9])"; then + echo -e "This version of Proxmox Virtual Environment is not supported" + echo -e "Requires PVE Version 8.0 or higher" + echo -e "Exiting..." + sleep 2 + exit +fi + +OPTIONS=(Install "Install NetData on Proxmox VE" \ + Uninstall "Uninstall NetData from Proxmox VE") + +CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "NetData" --menu "Select an option:" 10 58 2 \ + "${OPTIONS[@]}" 3>&1 1>&2 2>&3) + +case $CHOICE in + "Install") + install + ;; + "Uninstall") + uninstall + ;; + *) + echo "Exiting..." + exit 0 + ;; +esac diff --git a/misc/olivetin.sh b/misc/olivetin.sh new file mode 100644 index 00000000..f3909ad9 --- /dev/null +++ b/misc/olivetin.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ ___ _______ + / __ \/ (_) _____/_ __(_)___ + / / / / / / | / / _ \/ / / / __ \ +/ /_/ / / /| |/ / __/ / / / / / / +\____/_/_/ |___/\___/_/ /_/_/ /_/ + +EOF +} + +IP=$(hostname -I | awk '{print $1}') +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +APP="OliveTin" +hostname="$(hostname)" +set-e +header_info + +while true; do + read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +header_info + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +msg_info "Installing ${APP}" +wget -q https://github.com/OliveTin/OliveTin/releases/latest/download/OliveTin_linux_amd64.deb +dpkg -i OliveTin_linux_amd64.deb &>/dev/null +systemctl enable --now OliveTin &>/dev/null +rm OliveTin_linux_amd64.deb +msg_ok "Installed ${APP} on $hostname" + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://$IP:1337${CL} \n" diff --git a/misc/pbs3-upgrade.sh b/misc/pbs3-upgrade.sh new file mode 100644 index 00000000..4565811e --- /dev/null +++ b/misc/pbs3-upgrade.sh @@ -0,0 +1,172 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +header_info() { + clear + cat <<"EOF" + ____ ____ __________ __ ______ __________ ___ ____ ______ + / __ \/ __ ) ___/__ / / / / / __ \/ ____/ __ \/ | / __ \/ ____/ + / /_/ / __ \__ \ /_ < / / / / /_/ / / __/ /_/ / /| | / / / / __/ + / ____/ /_/ /__/ /__/ / / /_/ / ____/ /_/ / _, _/ ___ |/ /_/ / /___ +/_/ /_____/____/____/ \____/_/ \____/_/ |_/_/ |_/_____/_____/ + +EOF +} + +RD=$(echo "\033[01;31m") +YW=$(echo "\033[33m") +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" + +set -euo pipefail +shopt -s inherit_errexit nullglob + +msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + + +start_routines() { + header_info + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "PBS 2 BACKUP" --menu "\nMake a backup of /etc/proxmox-backup to ensure that in the worst case, any relevant configuration can be recovered?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Backing up Proxmox Backup Server 2" + tar czf "pbs2-etc-backup-$(date -I).tar.gz" -C "/etc" "proxmox-backup" + msg_ok "Backed up Proxmox Backup Server 2" + ;; + no) + msg_error "Selected no to Backing up Proxmox Backup Server 2" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "PBS 3 SOURCES" --menu "This will set the correct sources to update and install Proxmox Backup Server 3.\n \nChange to Proxmox Backup Server 3 sources?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Changing to Proxmox Backup Server 3 Sources" + cat </etc/apt/sources.list +deb http://deb.debian.org/debian bookworm main contrib +deb http://deb.debian.org/debian bookworm-updates main contrib +deb http://security.debian.org/debian-security bookworm-security main contrib +EOF + msg_ok "Changed to Proxmox Backup Server 3 Sources" + ;; + no) + msg_error "Selected no to Correcting Proxmox Backup Server 3 Sources" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "PBS3-ENTERPRISE" --menu "The 'pbs-enterprise' repository is only available to users who have purchased a Proxmox VE subscription.\n \nDisable 'pbs-enterprise' repository?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Disabling 'pbs-enterprise' repository" + cat </etc/apt/sources.list.d/pbs-enterprise.list +# deb https://enterprise.proxmox.com/debian/pbs bookworm pbs-enterprise +EOF + msg_ok "Disabled 'pbs-enterprise' repository" + ;; + no) + msg_error "Selected no to Disabling 'pbs-enterprise' repository" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "PBS3-NO-SUBSCRIPTION" --menu "The 'pbs-no-subscription' repository provides access to all of the open-source components of Proxmox Backup Server.\n \nEnable 'pbs-no-subscription' repository?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Enabling 'pbs-no-subscription' repository" + cat </etc/apt/sources.list.d/pbs-install-repo.list +deb http://download.proxmox.com/debian/pbs bookworm pbs-no-subscription +EOF + msg_ok "Enabled 'pbs-no-subscription' repository" + ;; + no) + msg_error "Selected no to Enabling 'pbs-no-subscription' repository" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "PBS3 TEST" --menu "The 'pbstest' repository can give advanced users access to new features and updates before they are officially released.\n \nAdd (Disabled) 'pbstest' repository?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Adding 'pbstest' repository and set disabled" + cat </etc/apt/sources.list.d/pbstest-for-beta.list +# deb http://download.proxmox.com/debian/pbs bookworm pbstest +EOF + msg_ok "Added 'pbstest' repository" + ;; + no) + msg_error "Selected no to Adding 'pbstest' repository" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "PBS 3 UPDATE" --menu "\nUpdate to Proxmox Backup Server 3 now?" 11 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Updating to Proxmox Backup Server 3 (Patience)" + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" dist-upgrade -y + msg_ok "Updated to Proxmox Backup Server 3" + ;; + no) + msg_error "Selected no to Updating to Proxmox Backup Server 3" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "REBOOT" --menu "\nReboot Proxmox Backup Server 3 now? (recommended)" 11 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Rebooting Proxmox Backup Server 3" + sleep 2 + msg_ok "Completed Install Routines" + reboot + ;; + no) + msg_error "Selected no to Rebooting Proxmox Backup Server 3 (Reboot recommended)" + msg_ok "Completed Install Routines" + ;; + esac +} + +header_info +while true; do + read -p "Start the Update to Proxmox Backup Server 3 Script (y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) clear; exit ;; + *) echo "Please answer yes or no." ;; + esac +done + +start_routines diff --git a/misc/post-pbs-install.sh b/misc/post-pbs-install.sh new file mode 100644 index 00000000..550626be --- /dev/null +++ b/misc/post-pbs-install.sh @@ -0,0 +1,184 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +header_info() { + clear + cat <<"EOF" + ____ ____ _____ ____ __ ____ __ ____ + / __ \/ __ ) ___/ / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / / + / /_/ / __ \__ \ / /_/ / __ \/ ___/ __/ / // __ \/ ___/ __/ __ `/ / / + / ____/ /_/ /__/ / / ____/ /_/ (__ ) /_ _/ // / / (__ ) /_/ /_/ / / / +/_/ /_____/____/ /_/ \____/____/\__/ /___/_/ /_/____/\__/\__,_/_/_/ + +EOF +} + +RD=$(echo "\033[01;31m") +YW=$(echo "\033[33m") +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" + +set -euo pipefail +shopt -s inherit_errexit nullglob + +msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + + +start_routines() { + header_info + VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)" + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "PBS SOURCES" --menu "This will set the correct sources to update and install Proxmox Backup Server.\n \nChange to Proxmox Backup Server sources?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Changing to Proxmox Backup Server Sources" + cat </etc/apt/sources.list +deb http://deb.debian.org/debian ${VERSION} main contrib +deb http://deb.debian.org/debian ${VERSION}-updates main contrib +deb http://security.debian.org/debian-security ${VERSION}-security main contrib +EOF + msg_ok "Changed to Proxmox Backup Server Sources" + ;; + no) + msg_error "Selected no to Correcting Proxmox Backup Server Sources" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "PBS-ENTERPRISE" --menu "The 'pbs-enterprise' repository is only available to users who have purchased a Proxmox VE subscription.\n \nDisable 'pbs-enterprise' repository?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Disabling 'pbs-enterprise' repository" + cat </etc/apt/sources.list.d/pbs-enterprise.list +# deb https://enterprise.proxmox.com/debian/pbs ${VERSION} pbs-enterprise +EOF + msg_ok "Disabled 'pbs-enterprise' repository" + ;; + no) + msg_error "Selected no to Disabling 'pbs-enterprise' repository" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "PBS-NO-SUBSCRIPTION" --menu "The 'pbs-no-subscription' repository provides access to all of the open-source components of Proxmox Backup Server.\n \nEnable 'pbs-no-subscription' repository?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Enabling 'pbs-no-subscription' repository" + cat </etc/apt/sources.list.d/pbs-install-repo.list +deb http://download.proxmox.com/debian/pbs ${VERSION} pbs-no-subscription +EOF + msg_ok "Enabled 'pbs-no-subscription' repository" + ;; + no) + msg_error "Selected no to Enabling 'pbs-no-subscription' repository" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "PBS TEST" --menu "The 'pbstest' repository can give advanced users access to new features and updates before they are officially released.\n \nAdd (Disabled) 'pbstest' repository?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Adding 'pbstest' repository and set disabled" + cat </etc/apt/sources.list.d/pbstest-for-beta.list +# deb http://download.proxmox.com/debian/pbs ${VERSION} pbstest +EOF + msg_ok "Added 'pbstest' repository" + ;; + no) + msg_error "Selected no to Adding 'pbstest' repository" + ;; + esac + + if [[ ! -f /etc/apt/apt.conf.d/no-nag-script ]]; then + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUBSCRIPTION NAG" --menu "This will disable the nag message reminding you to purchase a subscription every time you log in to the web interface.\n \nDisable subscription nag?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Support Subscriptions" "Supporting the software's development team is essential. Check their official website's Support Subscriptions for pricing. Without their dedicated work, we wouldn't have this exceptional software." 10 58 + msg_info "Disabling subscription nag" + echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data\.status.*{/{s/\!//;s/active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" >/etc/apt/apt.conf.d/no-nag-script + apt --reinstall install proxmox-widget-toolkit &>/dev/null + msg_ok "Disabled subscription nag (Delete browser cache)" + ;; + no) + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Support Subscriptions" "Supporting the software's development team is essential. Check their official website's Support Subscriptions for pricing. Without their dedicated work, we wouldn't have this exceptional software." 10 58 + msg_error "Selected no to Disabling subscription nag" + ;; + esac + fi + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UPDATE" --menu "\nUpdate Proxmox Backup Server now?" 11 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Updating Proxmox Backup Server (Patience)" + apt-get update &>/dev/null + apt-get -y dist-upgrade &>/dev/null + msg_ok "Updated Proxmox Backup Server" + ;; + no) + msg_error "Selected no to Updating Proxmox Backup Server" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "REBOOT" --menu "\nReboot Proxmox Backup Server now? (recommended)" 11 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Rebooting Proxmox Backup Server" + sleep 2 + msg_ok "Completed Post Install Routines" + reboot + ;; + no) + msg_error "Selected no to Rebooting Proxmox Backup Server (Reboot recommended)" + msg_ok "Completed Post Install Routines" + ;; + esac +} + +header_info +echo -e "\nThis script will Perform Post Install Routines.\n" +while true; do + read -p "Start the Proxmox Backup Server Post Install Script (y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) clear; exit ;; + *) echo "Please answer yes or no." ;; + esac +done + +if command -v pveversion >/dev/null 2>&1; then + echo -e "\n🛑 PVE Detected, Wrong Script!\n" + exit 1 +fi + +start_routines diff --git a/misc/post-pve-install.sh b/misc/post-pve-install.sh new file mode 100644 index 00000000..f142b850 --- /dev/null +++ b/misc/post-pve-install.sh @@ -0,0 +1,242 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +header_info() { + clear + cat <<"EOF" + ____ _ ________ ____ __ ____ __ ____ + / __ \ | / / ____/ / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / / + / /_/ / | / / __/ / /_/ / __ \/ ___/ __/ / // __ \/ ___/ __/ __ `/ / / + / ____/| |/ / /___ / ____/ /_/ (__ ) /_ _/ // / / (__ ) /_/ /_/ / / / +/_/ |___/_____/ /_/ \____/____/\__/ /___/_/ /_/____/\__/\__,_/_/_/ + +EOF +} + +RD=$(echo "\033[01;31m") +YW=$(echo "\033[33m") +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" + +set -euo pipefail +shopt -s inherit_errexit nullglob + +msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +start_routines() { + header_info + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SOURCES" --menu "The package manager will use the correct sources to update and install packages on your Proxmox VE server.\n \nCorrect Proxmox VE sources?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Correcting Proxmox VE Sources" + cat </etc/apt/sources.list +deb http://deb.debian.org/debian bookworm main contrib +deb http://deb.debian.org/debian bookworm-updates main contrib +deb http://security.debian.org/debian-security bookworm-security main contrib +EOF +echo 'APT::Get::Update::SourceListWarnings::NonFreeFirmware "false";' >/etc/apt/apt.conf.d/no-bookworm-firmware.conf + msg_ok "Corrected Proxmox VE Sources" + ;; + no) + msg_error "Selected no to Correcting Proxmox VE Sources" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "PVE-ENTERPRISE" --menu "The 'pve-enterprise' repository is only available to users who have purchased a Proxmox VE subscription.\n \nDisable 'pve-enterprise' repository?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Disabling 'pve-enterprise' repository" + cat </etc/apt/sources.list.d/pve-enterprise.list +# deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise +EOF + msg_ok "Disabled 'pve-enterprise' repository" + ;; + no) + msg_error "Selected no to Disabling 'pve-enterprise' repository" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "PVE-NO-SUBSCRIPTION" --menu "The 'pve-no-subscription' repository provides access to all of the open-source components of Proxmox VE.\n \nEnable 'pve-no-subscription' repository?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Enabling 'pve-no-subscription' repository" + cat </etc/apt/sources.list.d/pve-install-repo.list +deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription +EOF + msg_ok "Enabled 'pve-no-subscription' repository" + ;; + no) + msg_error "Selected no to Enabling 'pve-no-subscription' repository" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CEPH PACKAGE REPOSITORIES" --menu "The 'Ceph Package Repositories' provides access to both the 'no-subscription' and 'enterprise' repositories (initially disabled).\n \nCorrect 'ceph package sources?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Correcting 'ceph package repositories'" + cat </etc/apt/sources.list.d/ceph.list +# deb https://enterprise.proxmox.com/debian/ceph-quincy bookworm enterprise +# deb http://download.proxmox.com/debian/ceph-quincy bookworm no-subscription +# deb https://enterprise.proxmox.com/debian/ceph-reef bookworm enterprise +# deb http://download.proxmox.com/debian/ceph-reef bookworm no-subscription +EOF + msg_ok "Corrected 'ceph package repositories'" + ;; + no) + msg_error "Selected no to Correcting 'ceph package repositories'" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "PVETEST" --menu "The 'pvetest' repository can give advanced users access to new features and updates before they are officially released.\n \nAdd (Disabled) 'pvetest' repository?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Adding 'pvetest' repository and set disabled" + cat </etc/apt/sources.list.d/pvetest-for-beta.list +# deb http://download.proxmox.com/debian/pve bookworm pvetest +EOF + msg_ok "Added 'pvetest' repository" + ;; + no) + msg_error "Selected no to Adding 'pvetest' repository" + ;; + esac + + if [[ ! -f /etc/apt/apt.conf.d/no-nag-script ]]; then + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUBSCRIPTION NAG" --menu "This will disable the nag message reminding you to purchase a subscription every time you log in to the web interface.\n \nDisable subscription nag?" 14 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Support Subscriptions" "Supporting the software's development team is essential. Check their official website's Support Subscriptions for pricing. Without their dedicated work, we wouldn't have this exceptional software." 10 58 + msg_info "Disabling subscription nag" + echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/.*data\.status.*{/{s/\!//;s/active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" >/etc/apt/apt.conf.d/no-nag-script + apt --reinstall install proxmox-widget-toolkit &>/dev/null + msg_ok "Disabled subscription nag (Delete browser cache)" + ;; + no) + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Support Subscriptions" "Supporting the software's development team is essential. Check their official website's Support Subscriptions for pricing. Without their dedicated work, we wouldn't have this exceptional software." 10 58 + msg_error "Selected no to Disabling subscription nag" + ;; + esac + fi + + if ! systemctl is-active --quiet pve-ha-lrm; then + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "HIGH AVAILABILITY" --menu "Enable high availability?" 10 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Enabling high availability" + systemctl enable -q --now pve-ha-lrm + systemctl enable -q --now pve-ha-crm + systemctl enable -q --now corosync + msg_ok "Enabled high availability" + ;; + no) + msg_error "Selected no to Enabling high availability" + ;; + esac + fi + + if systemctl is-active --quiet pve-ha-lrm; then + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "HIGH AVAILABILITY" --menu "If you plan to utilize a single node instead of a clustered environment, you can disable unnecessary high availability (HA) services, thus reclaiming system resources.\n\nIf HA becomes necessary at a later stage, the services can be re-enabled.\n\nDisable high availability?" 18 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Disabling high availability" + systemctl disable -q --now pve-ha-lrm + systemctl disable -q --now pve-ha-crm + systemctl disable -q --now corosync + msg_ok "Disabled high availability" + ;; + no) + msg_error "Selected no to Disabling high availability" + ;; + esac + fi + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UPDATE" --menu "\nUpdate Proxmox VE now?" 11 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Updating Proxmox VE (Patience)" + apt-get update &>/dev/null + apt-get -y dist-upgrade &>/dev/null + msg_ok "Updated Proxmox VE" + ;; + no) + msg_error "Selected no to Updating Proxmox VE" + ;; + esac + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "REBOOT" --menu "\nReboot Proxmox VE now? (recommended)" 11 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Rebooting Proxmox VE" + sleep 2 + msg_ok "Completed Post Install Routines" + reboot + ;; + no) + msg_error "Selected no to Rebooting Proxmox VE (Reboot recommended)" + msg_ok "Completed Post Install Routines" + ;; + esac +} + +header_info +echo -e "\nThis script will Perform Post Install Routines.\n" +while true; do + read -p "Start the Proxmox VE Post Install Script (y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) clear; exit ;; + *) echo "Please answer yes or no." ;; + esac +done + +if ! pveversion | grep -Eq "pve-manager/8.[0-2]"; then + msg_error "This version of Proxmox Virtual Environment is not supported" + echo -e "Requires Proxmox Virtual Environment Version 8.0 or later." + echo -e "Exiting..." + sleep 2 + exit +fi + +start_routines diff --git a/misc/pve8-upgrade.sh b/misc/pve8-upgrade.sh new file mode 100644 index 00000000..360b339b --- /dev/null +++ b/misc/pve8-upgrade.sh @@ -0,0 +1,136 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +header_info() { + clear + cat <<"EOF" + ____ _ ____________ __ ______ __________ ___ ____ ______ + / __ \ | / / ____( __ ) / / / / __ \/ ____/ __ \/ | / __ \/ ____/ + / /_/ / | / / __/ / __ | / / / / /_/ / / __/ /_/ / /| | / / / / __/ + / ____/| |/ / /___/ /_/ / / /_/ / ____/ /_/ / _, _/ ___ |/ /_/ / /___ +/_/ |___/_____/\____/ \____/_/ \____/_/ |_/_/ |_/_____/_____/ + +EOF +} + +RD=$(echo "\033[01;31m") +YW=$(echo "\033[33m") +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" + +set -euo pipefail +shopt -s inherit_errexit nullglob + +msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +start_routines() { + header_info + + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "PVE8 SOURCES" "This will set the correct sources to update and install Proxmox VE 8." 10 58 + msg_info "Changing to Proxmox VE 8 Sources" + cat </etc/apt/sources.list +deb http://ftp.debian.org/debian bookworm main contrib +deb http://ftp.debian.org/debian bookworm-updates main contrib +deb http://security.debian.org/debian-security bookworm-security main contrib +EOF + msg_ok "Changed to Proxmox VE 8 Sources" + + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "PVE8-ENTERPRISE" "The 'pve-enterprise' repository is only available to users who have purchased a Proxmox VE subscription." 10 58 + msg_info "Disabling 'pve-enterprise' repository" + cat </etc/apt/sources.list.d/pve-enterprise.list +# deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise +EOF + msg_ok "Disabled 'pve-enterprise' repository" + + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "PVE8-NO-SUBSCRIPTION" "The 'pve-no-subscription' repository provides access to all of the open-source components of Proxmox VE." 10 58 + msg_info "Enabling 'pve-no-subscription' repository" + cat </etc/apt/sources.list.d/pve-install-repo.list +deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription +EOF + msg_ok "Enabled 'pve-no-subscription' repository" + + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "PVE8 CEPH PACKAGE REPOSITORIES" "The 'Ceph Package Repositories' provides access to both the 'no-subscription' and 'enterprise' repositories." 10 58 + msg_info "Enabling 'ceph package repositories'" + cat </etc/apt/sources.list.d/ceph.list +# deb https://enterprise.proxmox.com/debian/ceph-quincy bookworm enterprise +deb http://download.proxmox.com/debian/ceph-quincy bookworm no-subscription +EOF + msg_ok "Enabled 'ceph package repositories'" + + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "PVE8 TEST" "The 'pvetest' repository can give advanced users access to new features and updates before they are officially released (Disabled)." 10 58 + msg_info "Adding 'pvetest' repository and set disabled" + cat </etc/apt/sources.list.d/pvetest-for-beta.list +# deb http://download.proxmox.com/debian/pve bookworm pvetest +EOF + msg_ok "Added 'pvetest' repository" + + whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "PVE8 UPDATE" "Updating to Proxmox VE 8" 10 58 + msg_info "Updating to Proxmox VE 8 (Patience)" + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" dist-upgrade -y + msg_ok "Updated to Proxmox VE 8" + + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "REBOOT" --menu "\nReboot Proxmox VE 8 now? (recommended)" 11 58 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + case $CHOICE in + yes) + msg_info "Rebooting Proxmox VE 8" + sleep 2 + msg_ok "Completed Install Routines" + reboot + ;; + no) + msg_error "Selected no to Rebooting Proxmox VE 8 (Reboot recommended)" + msg_ok "Completed Install Routines" + ;; + esac +} + +header_info +while true; do + read -p "Start the Update to Proxmox VE 8 Script (y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) clear; exit ;; + *) echo "Please answer yes or no." ;; + esac +done + +if ! command -v pveversion >/dev/null 2>&1; then + header_info + msg_error "\n No PVE Detected!\n" + exit +fi + +if ! pveversion | grep -Eq "pve-manager/(7\.4-(16|17|18|19))"; then + header_info + msg_error "This version of Proxmox Virtual Environment is not supported" + echo -e " PVE Version 7.4-16 or higher is required." + echo -e "\nExiting..." + sleep 3 + exit +fi + +start_routines diff --git a/misc/pyenv.sh b/misc/pyenv.sh new file mode 100644 index 00000000..0a548e78 --- /dev/null +++ b/misc/pyenv.sh @@ -0,0 +1,159 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +set -e +YW=$(echo "\033[33m") +RD=$(echo "\033[01;31m") +BL=$(echo "\033[36m") +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" +BFR="\\r\\033[K" +HOLD="-" +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} +if command -v pveversion >/dev/null 2>&1; then msg_error "Can't Install on Proxmox "; exit; fi +msg_info "Installing pyenv" +apt-get install -y \ + make \ + build-essential \ + libjpeg-dev \ + libpcap-dev \ + libssl-dev \ + zlib1g-dev \ + libbz2-dev \ + libreadline-dev \ + libsqlite3-dev \ + autoconf \ + git \ + curl \ + sudo \ + llvm \ + libncursesw5-dev \ + xz-utils \ + tk-dev \ + libxml2-dev \ + libxmlsec1-dev \ + libffi-dev \ + libopenjp2-7 \ + libtiff5 \ + libturbojpeg0-dev \ + liblzma-dev &>/dev/null + +git clone https://github.com/pyenv/pyenv.git ~/.pyenv &>/dev/null +set +e +echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc +echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc +echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\nfi' >> ~/.bashrc +msg_ok "Installed pyenv" +. ~/.bashrc +set -e +msg_info "Installing Python 3.11.1" +pyenv install 3.11.1 &>/dev/null +pyenv global 3.11.1 +msg_ok "Installed Python 3.11.1" +read -r -p "Would you like to install Home Assistant Beta? " prompt +if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then +msg_info "Installing Home Assistant Beta" +cat </etc/systemd/system/homeassistant.service +[Unit] +Description=Home Assistant +After=network-online.target +[Service] +Type=simple +WorkingDirectory=/root/.homeassistant +ExecStart=/srv/homeassistant/bin/hass -c "/root/.homeassistant" +RestartForceExitStatus=100 +[Install] +WantedBy=multi-user.target +EOF +mkdir /srv/homeassistant +cd /srv/homeassistant +python3 -m venv . +source bin/activate +python3 -m pip install wheel &>/dev/null +pip3 install --upgrade pip &>/dev/null +pip3 install psycopg2-binary &>/dev/null +pip3 install --pre homeassistant &>/dev/null +systemctl enable homeassistant &>/dev/null +msg_ok "Installed Home Assistant Beta" +echo -e " Go to $(hostname -I | awk '{print $1}'):8123" +hass +fi + +read -r -p "Would you like to install ESPHome Beta? " prompt +if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then +msg_info "Installing ESPHome Beta" +mkdir /srv/esphome +cd /srv/esphome +python3 -m venv . +source bin/activate +python3 -m pip install wheel &>/dev/null +pip3 install --upgrade pip &>/dev/null +pip3 install --pre esphome &>/dev/null +cat </srv/esphome/start.sh +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /srv/esphome/bin/activate +esphome dashboard /srv/esphome/ +EOF +chmod +x start.sh +cat </etc/systemd/system/esphomedashboard.service +[Unit] +Description=ESPHome Dashboard Service +After=network.target +[Service] +Type=simple +User=root +WorkingDirectory=/srv/esphome +ExecStart=/srv/esphome/start.sh +RestartSec=30 +Restart=on-failure +[Install] +WantedBy=multi-user.target +EOF +systemctl enable --now esphomedashboard &>/dev/null +msg_ok "Installed ESPHome Beta" +echo -e " Go to $(hostname -I | awk '{print $1}'):6052" +exec $SHELL +fi + +read -r -p "Would you like to install Matter-Server (Beta)? " prompt +if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then +msg_info "Installing Matter Server" +apt-get install -y \ +libcairo2-dev \ +libjpeg62-turbo-dev \ +libgirepository1.0-dev \ +libpango1.0-dev \ +libgif-dev \ +g++ &>/dev/null +python3 -m pip install wheel +pip3 install --upgrade pip +pip install python-matter-server[server] +msg_ok "Installed Matter Server" +echo -e "Start server > python -m matter_server.server" +fi +msg_ok "\nFinished\n" +exec $SHELL diff --git a/misc/scaling-governor.sh b/misc/scaling-governor.sh new file mode 100644 index 00000000..3523ab2c --- /dev/null +++ b/misc/scaling-governor.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +set -e +header_info() { +clear +cat < MSG_MAX_LENGTH)) && MSG_MAX_LENGTH=${#ITEM}+OFFSET + GOVERNORS_MENU+=("$TAG" "$ITEM " "OFF") +done < <(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors | tr ' ' '\n' | grep -v "$current_governor") +scaling_governor=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Current CPU Scaling Governor is set to $current_governor" --checklist "\nSelect the Scaling Governor to use:\n" 16 $((MSG_MAX_LENGTH + 58)) 6 "${GOVERNORS_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit +[ -z "$scaling_governor" ] && { + whiptail --backtitle "Proxmox VE Helper Scripts" --title "No CPU Scaling Governor Selected" --msgbox "It appears that no CPU Scaling Governor was selected" 10 68 + clear + exit +} +echo "${scaling_governor}" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor >/dev/null +current_governor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) +whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Current CPU Scaling Governor" "\nCurrent CPU Scaling Governor has been set to $current_governor\n" 10 60 +CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CPU Scaling Governor" --menu "This will establish a crontab to maintain the CPU Scaling Governor configuration across reboots.\n \nSetup a crontab?" 14 68 2 \ + "yes" " " \ + "no" " " 3>&2 2>&1 1>&3) + +case $CHOICE in + yes) + set +e + NEW_CRONTAB_COMMAND="(sleep 60 && echo \"$current_governor\" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor)" + EXISTING_CRONTAB=$(crontab -l 2>/dev/null) + if [[ -n "$EXISTING_CRONTAB" ]]; then + TEMP_CRONTAB_FILE=$(mktemp) + echo "$EXISTING_CRONTAB" | grep -v "@reboot (sleep 60 && echo*" > "$TEMP_CRONTAB_FILE" + crontab "$TEMP_CRONTAB_FILE" + rm "$TEMP_CRONTAB_FILE" + fi + (crontab -l 2>/dev/null; echo "@reboot $NEW_CRONTAB_COMMAND") | crontab - + echo -e "\nCrontab Set (use 'crontab -e' to check)" + ;; + no) + echo -e "\n\033[31mNOTE: Settings return to default after reboot\033[m\n" + ;; +esac +echo -e "Current CPU Scaling Governor is set to \033[36m$current_governor\033[m\n" diff --git a/misc/update-lxcs-cron.sh b/misc/update-lxcs-cron.sh new file mode 100644 index 00000000..04827734 --- /dev/null +++ b/misc/update-lxcs-cron.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +echo "$(date)" +excluded_containers=("$@") +function update_container() { + container=$1 + name=$(pct exec "$container" hostname) + os=$(pct config "$container" | awk '/^ostype/ {print $2}') + if [[ "$os" == "ubuntu" || "$os" == "debian" ]]; then + disk_info=$(pct exec "$container" df /boot | awk 'NR==2{gsub("%","",$5); printf "%s %.1fG %.1fG %.1fG", $5, $3/1024/1024, $2/1024/1024, $4/1024/1024 }') + read -ra disk_info_array <<<"$disk_info" + echo -e "\n[Info] Updating $container : $name - Boot Disk: ${disk_info_array[0]}% full [${disk_info_array[1]}/${disk_info_array[2]} used, ${disk_info_array[3]} free]" + else + echo -e "\n[Info] Updating $container : $name - [No disk info for ${os}]" + fi + case "$os" in + alpine) pct exec "$container" -- ash -c "apk update && apk upgrade" ;; + archlinux) pct exec "$container" -- bash -c "pacman -Syyu --noconfirm" ;; + fedora | rocky | centos | alma) pct exec "$container" -- bash -c "dnf -y update && dnf -y upgrade" ;; + ubuntu | debian | devuan) pct exec "$container" -- bash -c "apt-get update 2>/dev/null | grep 'packages.*upgraded'; apt-get upgrade --dry-run && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" dist-upgrade -y; rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED" ;; + esac +} + +for container in $(pct list | awk '{if(NR>1) print $1}'); do + excluded=false + for excluded_container in "${excluded_containers[@]}"; do + if [ "$container" == "$excluded_container" ]; then + excluded=true + break + fi + done + if [ "$excluded" == true ]; then + echo -e "[Info] Skipping $container" + sleep 1 + else + status=$(pct status $container) + template=$(pct config $container | grep -q "template:" && echo "true" || echo "false") + if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then + echo -e "[Info] Starting $container" + pct start $container + echo -e "[Info] Waiting For $container To Start" + sleep 5 + update_container $container + echo -e "[Info] Shutting down $container" + pct shutdown $container & + elif [ "$status" == "status: running" ]; then + update_container $container + fi + fi +done +wait + +echo -e "Finished, All Containers Updated. \n" diff --git a/misc/update-lxcs.sh b/misc/update-lxcs.sh new file mode 100644 index 00000000..9167186e --- /dev/null +++ b/misc/update-lxcs.sh @@ -0,0 +1,111 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + __ __ __ __ __ _ ________ + / / / /___ ____/ /___ _/ /____ / / | |/ / ____/ + / / / / __ \/ __ / __ `/ __/ _ \ / / | / / +/ /_/ / /_/ / /_/ / /_/ / /_/ __/ / /___/ / /___ +\____/ .___/\__,_/\__,_/\__/\___/ /_____/_/|_\____/ + /_/ + +EOF +} +set -eEuo pipefail +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +RD=$(echo "\033[01;31m") +CM='\xE2\x9C\x94\033' +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +header_info +echo "Loading..." +whiptail --backtitle "Proxmox VE Helper Scripts" --title "Proxmox VE LXC Updater" --yesno "This Will Update LXC Containers. Proceed?" 10 58 || exit +NODE=$(hostname) +EXCLUDE_MENU=() +MSG_MAX_LENGTH=0 +while read -r TAG ITEM; do + OFFSET=2 + ((${#ITEM} + OFFSET > MSG_MAX_LENGTH)) && MSG_MAX_LENGTH=${#ITEM}+OFFSET + EXCLUDE_MENU+=("$TAG" "$ITEM " "OFF") +done < <(pct list | awk 'NR>1') +excluded_containers=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Containers on $NODE" --checklist "\nSelect containers to skip from updates:\n" 16 $((MSG_MAX_LENGTH + 23)) 6 "${EXCLUDE_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit + +function needs_reboot() { + local container=$1 + local os=$(pct config "$container" | awk '/^ostype/ {print $2}') + local reboot_required_file="/var/run/reboot-required.pkgs" + if [ -f "$reboot_required_file" ]; then + if [[ "$os" == "ubuntu" || "$os" == "debian" ]]; then + if pct exec "$container" -- [ -s "$reboot_required_file" ]; then + return 0 + fi + fi + fi + return 1 +} + +function update_container() { + container=$1 + header_info + name=$(pct exec "$container" hostname) + os=$(pct config "$container" | awk '/^ostype/ {print $2}') + if [[ "$os" == "ubuntu" || "$os" == "debian" || "$os" == "fedora" ]]; then + disk_info=$(pct exec "$container" df /boot | awk 'NR==2{gsub("%","",$5); printf "%s %.1fG %.1fG %.1fG", $5, $3/1024/1024, $2/1024/1024, $4/1024/1024 }') + read -ra disk_info_array <<<"$disk_info" + echo -e "${BL}[Info]${GN} Updating ${BL}$container${CL} : ${GN}$name${CL} - ${YW}Boot Disk: ${disk_info_array[0]}% full [${disk_info_array[1]}/${disk_info_array[2]} used, ${disk_info_array[3]} free]${CL}\n" + else + echo -e "${BL}[Info]${GN} Updating ${BL}$container${CL} : ${GN}$name${CL} - ${YW}[No disk info for ${os}]${CL}\n" + fi + case "$os" in + alpine) pct exec "$container" -- ash -c "apk update && apk upgrade" ;; + archlinux) pct exec "$container" -- bash -c "pacman -Syyu --noconfirm" ;; + fedora | rocky | centos | alma) pct exec "$container" -- bash -c "dnf -y update && dnf -y upgrade" ;; + ubuntu | debian | devuan) pct exec "$container" -- bash -c "apt-get update 2>/dev/null | grep 'packages.*upgraded'; apt list --upgradable && apt-get -yq dist-upgrade 2>&1; rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED" ;; + esac +} + +containers_needing_reboot=() +header_info +for container in $(pct list | awk '{if(NR>1) print $1}'); do + if [[ " ${excluded_containers[@]} " =~ " $container " ]]; then + header_info + echo -e "${BL}[Info]${GN} Skipping ${BL}$container${CL}" + sleep 1 + else + status=$(pct status $container) + template=$(pct config $container | grep -q "template:" && echo "true" || echo "false") + if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then + echo -e "${BL}[Info]${GN} Starting${BL} $container ${CL} \n" + pct start $container + echo -e "${BL}[Info]${GN} Waiting For${BL} $container${CL}${GN} To Start ${CL} \n" + sleep 5 + update_container $container + echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL} \n" + pct shutdown $container & + elif [ "$status" == "status: running" ]; then + update_container $container + fi + if pct exec "$container" -- [ -e "/var/run/reboot-required" ]; then + # Get the container's hostname and add it to the list + container_hostname=$(pct exec "$container" hostname) + containers_needing_reboot+=("$container ($container_hostname)") + fi + fi +done +wait +header_info +echo -e "${GN}The process is complete, and the selected containers have been updated.${CL}\n" +if [ "${#containers_needing_reboot[@]}" -gt 0 ]; then + echo -e "${RD}The following containers require a reboot:${CL}" + for container_name in "${containers_needing_reboot[@]}"; do + echo "$container_name" + done +fi +echo "" diff --git a/misc/usb-passthrough.sh b/misc/usb-passthrough.sh new file mode 100644 index 00000000..25ceb3e6 --- /dev/null +++ b/misc/usb-passthrough.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +echo -e "\e[1;33m This script will allow USB passthrough to a PRIVILEGED LXC Container ONLY\e[0m" +while true; do + read -p "Did you replace 106 with your LXC ID? Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done + +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +CHAR_DEVS+=("166:.*") +CHAR_DEVS+=("188:.*") +CHAR_DEVS+=("189:.*") + +for char_dev in ${CHAR_DEVS[@]}; do + [ ! -z "${CHAR_DEV_STRING-}" ] && CHAR_DEV_STRING+=" -o" + CHAR_DEV_STRING+=" -regex \".*/${char_dev}\"" +done + +read -r -d '' HOOK_SCRIPT <<-EOF || true +for char_dev in \$(find /sys/dev/char -regextype sed $CHAR_DEV_STRING); do + dev="/dev/\$(sed -n "/DEVNAME/ s/^.*=\(.*\)$/\1/p" \${char_dev}/uevent)"; + mkdir -p \$(dirname \${LXC_ROOTFS_MOUNT}\${dev}); + for link in \$(udevadm info --query=property \$dev | sed -n "s/DEVLINKS=//p"); do + mkdir -p \${LXC_ROOTFS_MOUNT}\$(dirname \$link); + cp -dpR \$link \${LXC_ROOTFS_MOUNT}\${link}; + done; + cp -dpR \$dev \${LXC_ROOTFS_MOUNT}\${dev}; +done; +EOF +HOOK_SCRIPT=${HOOK_SCRIPT//$'\n'/} + +CTID=$1 +CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf +sed '/autodev/d' $CTID_CONFIG_PATH >CTID.conf +cat CTID.conf >$CTID_CONFIG_PATH + +cat <>$CTID_CONFIG_PATH +lxc.autodev: 1 +lxc.hook.autodev: bash -c '$HOOK_SCRIPT' +EOF +echo -e "\e[1;33m Finished....Reboot ${CTID} LXC to apply the changes \e[0m" diff --git a/misc/webmin.sh b/misc/webmin.sh new file mode 100644 index 00000000..a7188b01 --- /dev/null +++ b/misc/webmin.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + _ __ __ _ + | | /| / /__ / / __ _ (_)__ + | |/ |/ / -_) _ \/ ' \/ / _ \ + |__/|__/\__/_.__/_/_/_/_/_//_/ + +EOF +} +set -eEuo pipefail +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +CM="${GN}✓${CL}" +BFR="\\r\\033[K" +HOLD="-" + +msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +header_info + +whiptail --backtitle "Proxmox VE Helper Scripts" --title "Webmin Installer" --yesno "This Will Install Webmin on this LXC Container. Proceed?" 10 58 || exit + +msg_info "Installing Prerequisites" +apt update &>/dev/null +apt-get -y install libnet-ssleay-perl libauthen-pam-perl libio-pty-perl unzip shared-mime-info &>/dev/null +msg_ok "Installed Prerequisites" + +LATEST=$(curl -sL https://api.github.com/repos/webmin/webmin/releases/latest | grep '"tag_name":' | cut -d'"' -f4) + +msg_info "Downloading Webmin" +wget -q https://github.com/webmin/webmin/releases/download/$LATEST/webmin_${LATEST}_all.deb +msg_ok "Downloaded Webmin" + +msg_info "Installing Webmin" +dpkg -i webmin_${LATEST}_all.deb &>/dev/null +/usr/share/webmin/changepass.pl /etc/webmin root root &>/dev/null +rm -rf /root/webmin_${LATEST}_all.deb +msg_ok "Installed Webmin" + +IP=$(hostname -I | cut -f1 -d ' ') +echo -e "Successfully Installed!! Webmin should be reachable by going to ${BL}https://${IP}:10000${CL}" diff --git a/turnkey/turnkey.sh b/turnkey/turnkey.sh new file mode 100644 index 00000000..202143cf --- /dev/null +++ b/turnkey/turnkey.sh @@ -0,0 +1,241 @@ +#!/usr/bin/env bash +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + ______ __ __ __ _ _______ +/_ __/_ _________ / //_/__ __ __ / / | |/_/ ___/ + / / / // / __/ _ \/ ,< / -_) // / / /___> &2 + [ ! -z ${CTID-} ] && cleanup_ctid + exit $EXIT +} +function warn() { + local REASON="\e[97m$1\e[39m" + local FLAG="\e[93m[WARNING]\e[39m" + msg "$FLAG $REASON" +} +function info() { + local REASON="$1" + local FLAG="\e[36m[INFO]\e[39m" + msg "$FLAG $REASON" +} +function msg() { + local TEXT="$1" + echo -e "$TEXT" +} +function cleanup_ctid() { + if pct status $CTID &>/dev/null; then + if [ "$(pct status $CTID | awk '{print $2}')" == "running" ]; then + pct stop $CTID + fi + pct destroy $CTID + fi +} + +# Stop Proxmox VE Monitor-All if running +if systemctl is-active -q ping-instances.service; then + systemctl stop ping-instances.service +fi +header_info +whiptail --backtitle "Proxmox VE Helper Scripts" --title "TurnKey LXCs" --yesno "This will allow for the creation of one of the many TurnKey LXC Containers. Proceed?" 10 68 || exit +TURNKEY_MENU=() +MSG_MAX_LENGTH=0 +while read -r TAG ITEM; do + OFFSET=2 + ((${#ITEM} + OFFSET > MSG_MAX_LENGTH)) && MSG_MAX_LENGTH=${#ITEM}+OFFSET + TURNKEY_MENU+=("$TAG" "$ITEM " "OFF") +done < <( + cat <&1 1>&2 2>&3 | tr -d '"') || exit +[ -z "$turnkey" ] && { + whiptail --backtitle "Proxmox VE Helper Scripts" --title "No TurnKey LXC Selected" --msgbox "It appears that no TurnKey LXC container was selected" 10 68 + msg "Done" + exit +} + +# Setup script environment +PASS="$(openssl rand -base64 8)" +CTID=$(pvesh get /cluster/nextid) +PCT_OPTIONS=" + -features keyctl=1,nesting=1 + -hostname turnkey-${turnkey} + -tags proxmox-helper-scripts + -onboot 1 + -cores 2 + -memory 2048 + -password $PASS + -net0 name=eth0,bridge=vmbr0,ip=dhcp + -unprivileged 1 + " +DEFAULT_PCT_OPTIONS=( + -arch $(dpkg --print-architecture) +) + +# Set the CONTENT and CONTENT_LABEL variables +function select_storage() { + local CLASS=$1 + local CONTENT + local CONTENT_LABEL + case $CLASS in + container) + CONTENT='rootdir' + CONTENT_LABEL='Container' + ;; + template) + CONTENT='vztmpl' + CONTENT_LABEL='Container template' + ;; + *) false || die "Invalid storage class." ;; + esac + + # Query all storage locations + local -a MENU + while read -r line; do + local TAG=$(echo $line | awk '{print $1}') + local TYPE=$(echo $line | awk '{printf "%-10s", $2}') + local FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') + local ITEM=" Type: $TYPE Free: $FREE " + local OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + local MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + MENU+=("$TAG" "$ITEM" "OFF") + done < <(pvesm status -content $CONTENT | awk 'NR>1') + + # Select storage location + if [ $((${#MENU[@]} / 3)) -eq 0 ]; then + warn "'$CONTENT_LABEL' needs to be selected for at least one storage location." + die "Unable to detect valid storage location." + elif [ $((${#MENU[@]} / 3)) -eq 1 ]; then + printf ${MENU[0]} + else + local STORAGE + while [ -z "${STORAGE:+x}" ]; do + STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \ + "Which storage pool you would like to use for the ${CONTENT_LABEL,,}?\n\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${MENU[@]}" 3>&1 1>&2 2>&3) || die "Menu aborted." + done + printf $STORAGE + fi +} + +# Get template storage +TEMPLATE_STORAGE=$(select_storage template) || exit +info "Using '$TEMPLATE_STORAGE' for template storage." + +# Get container storage +CONTAINER_STORAGE=$(select_storage container) || exit +info "Using '$CONTAINER_STORAGE' for container storage." + +# Update LXC template list +msg "Updating LXC template list..." +pveam update >/dev/null + +# Get LXC template string +mapfile -t TEMPLATES < <(pveam available -section turnkeylinux | awk -v turnkey="${turnkey}" '$0 ~ turnkey {print $2}' | sort -t - -k 2 -V) +[ ${#TEMPLATES[@]} -gt 0 ] || die "Unable to find a template when searching for '${turnkey}'." +TEMPLATE="${TEMPLATES[-1]}" + +# Download LXC template +if ! pveam list $TEMPLATE_STORAGE | grep -q $TEMPLATE; then + msg "Downloading LXC template (Patience)..." + pveam download $TEMPLATE_STORAGE $TEMPLATE >/dev/null || + die "A problem occured while downloading the LXC template." +fi + +# Create variable for 'pct' options +PCT_OPTIONS=(${PCT_OPTIONS[@]:-${DEFAULT_PCT_OPTIONS[@]}}) +[[ " ${PCT_OPTIONS[@]} " =~ " -rootfs " ]] || PCT_OPTIONS+=(-rootfs $CONTAINER_STORAGE:${PCT_DISK_SIZE:-8}) + +# Create LXC +msg "Creating LXC container..." +pct create $CTID ${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE} ${PCT_OPTIONS[@]} >/dev/null || + die "A problem occured while trying to create container." + +# Save password +echo "TurnKey ${turnkey} password: ${PASS}" >>~/turnkey-${turnkey}.creds # file is located in the Proxmox root directory + +# Start container +msg "Starting LXC Container..." +pct start "$CTID" +sleep 5 + +# Get container IP +set +euo pipefail # Turn off error checking +max_attempts=5 +attempt=1 +IP="" +while [[ $attempt -le $max_attempts ]]; do + IP=$(pct exec $CTID ip a show dev eth0 | grep -oP 'inet \K[^/]+') + if [[ -n $IP ]]; then + break + else + warn "Attempt $attempt: IP address not found. Pausing for 5 seconds..." + sleep 5 + ((attempt++)) + fi +done + +if [[ -z $IP ]]; then + warn "Maximum number of attempts reached. IP address not found." + IP="NOT FOUND" +fi + +# Start Proxmox VE Monitor-All if available +if [[ -f /etc/systemd/system/ping-instances.service ]]; then + systemctl start ping-instances.service +fi + +# Success message +header_info +echo +info "LXC container '$CTID' was successfully created, and its IP address is ${IP}." +echo +info "Proceed to the LXC console to complete the setup." +echo +info "login: root" +info "password: $PASS" +echo diff --git a/vm/debian-vm.sh b/vm/debian-vm.sh new file mode 100644 index 00000000..d6159317 --- /dev/null +++ b/vm/debian-vm.sh @@ -0,0 +1,426 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + ____ __ _ ______ + / __ \___ / /_ (_)___ _____ < /__ \ + / / / / _ \/ __ \/ / __ `/ __ \ / /__/ / + / /_/ / __/ /_/ / / /_/ / / / / / // __/ +/_____/\___/_.___/_/\__,_/_/ /_/ /_//____/ + +EOF +} +header_info +echo -e "\n Loading..." +GEN_MAC=02:$(openssl rand -hex 5 | awk '{print toupper($0)}' | sed 's/\(..\)/\1:/g; s/.$//') +NEXTID=$(pvesh get /cluster/nextid) + +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +HA=$(echo "\033[1;34m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" +THIN="discard=on,ssd=1," +set -e +trap 'error_handler $LINENO "$BASH_COMMAND"' ERR +trap cleanup EXIT +function error_handler() { + local exit_code="$?" + local line_number="$1" + local command="$2" + local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" + echo -e "\n$error_message\n" + cleanup_vmid +} + +function cleanup_vmid() { + if qm status $VMID &>/dev/null; then + qm stop $VMID &>/dev/null + qm destroy $VMID &>/dev/null + fi +} + +function cleanup() { + popd >/dev/null + rm -rf $TEMP_DIR +} + +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +if whiptail --backtitle "Proxmox VE Helper Scripts" --title "Debian 12 VM" --yesno "This will create a New Debian 12 VM. Proceed?" 10 58; then + : +else + header_info && echo -e "⚠ User exited script \n" && exit +fi + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +function check_root() { + if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then + clear + msg_error "Please run this script as root." + echo -e "\nExiting..." + sleep 2 + exit + fi +} + +function pve_check() { + if ! pveversion | grep -Eq "pve-manager/8.[1-3]"; then + msg_error "This version of Proxmox Virtual Environment is not supported" + echo -e "Requires Proxmox Virtual Environment Version 8.1 or later." + echo -e "Exiting..." + sleep 2 + exit +fi +} + +function arch_check() { + if [ "$(dpkg --print-architecture)" != "amd64" ]; then + msg_error "This script will not work with PiMox! \n" + echo -e "Exiting..." + sleep 2 + exit + fi +} + +function ssh_check() { + if command -v pveversion >/dev/null 2>&1; then + if [ -n "${SSH_CLIENT:+x}" ]; then + if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "SSH DETECTED" --yesno "It's suggested to use the Proxmox shell instead of SSH, since SSH can create issues while gathering variables. Would you like to proceed with using SSH?" 10 62; then + echo "you've been warned" + else + clear + exit + fi + fi + fi +} + +function exit-script() { + clear + echo -e "⚠ User exited script \n" + exit +} + +function default_settings() { + VMID="$NEXTID" + FORMAT=",efitype=4m" + MACHINE="" + DISK_CACHE="" + HN="debian" + CPU_TYPE="" + CORE_COUNT="2" + RAM_SIZE="2048" + BRG="vmbr0" + MAC="$GEN_MAC" + VLAN="" + MTU="" + START_VM="yes" + echo -e "${DGN}Using Virtual Machine ID: ${BGN}${VMID}${CL}" + echo -e "${DGN}Using Machine Type: ${BGN}i440fx${CL}" + echo -e "${DGN}Using Disk Cache: ${BGN}None${CL}" + echo -e "${DGN}Using Hostname: ${BGN}${HN}${CL}" + echo -e "${DGN}Using CPU Model: ${BGN}KVM64${CL}" + echo -e "${DGN}Allocated Cores: ${BGN}${CORE_COUNT}${CL}" + echo -e "${DGN}Allocated RAM: ${BGN}${RAM_SIZE}${CL}" + echo -e "${DGN}Using Bridge: ${BGN}${BRG}${CL}" + echo -e "${DGN}Using MAC Address: ${BGN}${MAC}${CL}" + echo -e "${DGN}Using VLAN: ${BGN}Default${CL}" + echo -e "${DGN}Using Interface MTU Size: ${BGN}Default${CL}" + echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}" + echo -e "${BL}Creating a Debian 12 VM using the above default settings${CL}" +} + +function advanced_settings() { + while true; do + if VMID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Virtual Machine ID" 8 58 $NEXTID --title "VIRTUAL MACHINE ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z "$VMID" ]; then + VMID="$NEXTID" + fi + if pct status "$VMID" &>/dev/null || qm status "$VMID" &>/dev/null; then + echo -e "${CROSS}${RD} ID $VMID is already in use${CL}" + sleep 2 + continue + fi + echo -e "${DGN}Virtual Machine ID: ${BGN}$VMID${CL}" + break + else + exit-script + fi + done + + if MACH=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "MACHINE TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 10 58 2 \ + "i440fx" "Machine i440fx" ON \ + "q35" "Machine q35" OFF \ + 3>&1 1>&2 2>&3); then + if [ $MACH = q35 ]; then + echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" + FORMAT="" + MACHINE=" -machine q35" + else + echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" + FORMAT=",efitype=4m" + MACHINE="" + fi + else + exit-script + fi + + if DISK_CACHE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DISK CACHE" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \ + "0" "None (Default)" ON \ + "1" "Write Through" OFF \ + 3>&1 1>&2 2>&3); then + if [ $DISK_CACHE = "1" ]; then + echo -e "${DGN}Using Disk Cache: ${BGN}Write Through${CL}" + DISK_CACHE="cache=writethrough," + else + echo -e "${DGN}Using Disk Cache: ${BGN}None${CL}" + DISK_CACHE="" + fi + else + exit-script + fi + + if VM_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 debian --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VM_NAME ]; then + HN="debian" + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + else + HN=$(echo ${VM_NAME,,} | tr -d ' ') + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + fi + else + exit-script + fi + + if CPU_TYPE1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CPU MODEL" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \ + "0" "KVM64 (Default)" ON \ + "1" "Host" OFF \ + 3>&1 1>&2 2>&3); then + if [ $CPU_TYPE1 = "1" ]; then + echo -e "${DGN}Using CPU Model: ${BGN}Host${CL}" + CPU_TYPE=" -cpu host" + else + echo -e "${DGN}Using CPU Model: ${BGN}KVM64${CL}" + CPU_TYPE="" + fi + else + exit-script + fi + + if CORE_COUNT=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 2 --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $CORE_COUNT ]; then + CORE_COUNT="2" + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + else + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + fi + else + exit-script + fi + + if RAM_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 2048 --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $RAM_SIZE ]; then + RAM_SIZE="2048" + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + else + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + fi + else + exit-script + fi + + if BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $BRG ]; then + BRG="vmbr0" + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + else + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + fi + else + exit-script + fi + + if MAC1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a MAC Address" 8 58 $GEN_MAC --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MAC1 ]; then + MAC="$GEN_MAC" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC${CL}" + else + MAC="$MAC1" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + fi + else + exit-script + fi + + if VLAN1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VLAN1 ]; then + VLAN1="Default" + VLAN="" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + else + VLAN=",tag=$VLAN1" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + fi + else + exit-script + fi + + if MTU1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Interface MTU Size (leave blank for default)" 8 58 --title "MTU SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MTU1 ]; then + MTU1="Default" + MTU="" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + else + MTU=",mtu=$MTU1" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + fi + else + exit-script + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "START VIRTUAL MACHINE" --yesno "Start VM when completed?" 10 58); then + echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}" + START_VM="yes" + else + echo -e "${DGN}Start VM when completed: ${BGN}no${CL}" + START_VM="no" + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create a Debian 12 VM?" --no-button Do-Over 10 58); then + echo -e "${RD}Creating a Debian 12 VM using the above advanced settings${CL}" + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +function start_script() { + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +check_root +arch_check +pve_check +ssh_check +start_script + +msg_info "Validating Storage" +while read -r line; do + TAG=$(echo $line | awk '{print $1}') + TYPE=$(echo $line | awk '{printf "%-10s", $2}') + FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') + ITEM=" Type: $TYPE Free: $FREE " + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + STORAGE_MENU+=("$TAG" "$ITEM" "OFF") +done < <(pvesm status -content images | awk 'NR>1') +VALID=$(pvesm status -content images | awk 'NR>1') +if [ -z "$VALID" ]; then + msg_error "Unable to detect a valid storage location." + exit +elif [ $((${#STORAGE_MENU[@]} / 3)) -eq 1 ]; then + STORAGE=${STORAGE_MENU[0]} +else + while [ -z "${STORAGE:+x}" ]; do + STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \ + "Which storage pool you would like to use for ${HN}?\nTo make a selection, use the Spacebar.\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit + done +fi +msg_ok "Using ${CL}${BL}$STORAGE${CL} ${GN}for Storage Location." +msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}." +msg_info "Retrieving the URL for the Debian 12 Qcow2 Disk Image" +URL=https://cloud.debian.org/images/cloud/bookworm/20240507-1740/debian-12-nocloud-amd64-20240507-1740.qcow2 +sleep 2 +msg_ok "${CL}${BL}${URL}${CL}" +wget -q --show-progress $URL +echo -en "\e[1A\e[0K" +FILE=$(basename $URL) +msg_ok "Downloaded ${CL}${BL}${FILE}${CL}" + +STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') +case $STORAGE_TYPE in +nfs | dir) + DISK_EXT=".qcow2" + DISK_REF="$VMID/" + DISK_IMPORT="-format qcow2" + THIN="" + ;; +btrfs) + DISK_EXT=".raw" + DISK_REF="$VMID/" + DISK_IMPORT="-format raw" + FORMAT=",efitype=4m" + THIN="" + ;; +esac +for i in {0,1}; do + disk="DISK$i" + eval DISK${i}=vm-${VMID}-disk-${i}${DISK_EXT:-} + eval DISK${i}_REF=${STORAGE}:${DISK_REF:-}${!disk} +done + +msg_info "Creating a Debian 12 VM" +qm create $VMID -agent 1${MACHINE} -tablet 0 -localtime 1 -bios ovmf${CPU_TYPE} -cores $CORE_COUNT -memory $RAM_SIZE \ + -name $HN -tags proxmox-helper-scripts -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci +pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null +qm importdisk $VMID ${FILE} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null +qm set $VMID \ + -efidisk0 ${DISK0_REF}${FORMAT} \ + -scsi0 ${DISK1_REF},${DISK_CACHE}${THIN}size=2G \ + -boot order=scsi0 \ + -serial0 socket \ + -description "
+ + # Debian 12 VM + + +
" >/dev/null +msg_ok "Created a Debian 12 VM ${CL}${BL}(${HN})" +if [ "$START_VM" == "yes" ]; then + msg_info "Starting Debian 12 VM" + qm start $VMID + msg_ok "Started Debian 12 VM" +fi +msg_ok "Completed Successfully!\n" +echo "More Info at https://github.com/tteck/Proxmox/discussions/1988" diff --git a/vm/haos-vm.sh b/vm/haos-vm.sh new file mode 100644 index 00000000..90bb9751 --- /dev/null +++ b/vm/haos-vm.sh @@ -0,0 +1,466 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + __ __ ___ _ __ __ ____ _____ + / / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_ / __ \/ ___/ + / /_/ / __ \/ __ `__ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/ / / / /\__ \ + / __ / /_/ / / / / / / __/ / ___ |(__ |__ ) (__ ) /_/ /_/ / / / / /_ / /_/ /___/ / +/_/ /_/\____/_/ /_/ /_/\___/ /_/ |_/____/____/_/____/\__/\__,_/_/ /_/\__/ \____//____/ + +EOF +} +header_info +echo -e "\n Loading..." +GEN_MAC=02:$(openssl rand -hex 5 | awk '{print toupper($0)}' | sed 's/\(..\)/\1:/g; s/.$//') +NEXTID=$(pvesh get /cluster/nextid) +VERSIONS=(stable beta dev) +for version in "${VERSIONS[@]}"; do + eval "$version=$(curl -s https://raw.githubusercontent.com/home-assistant/version/master/$version.json | grep "ova" | cut -d '"' -f 4)" +done +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +HA=$(echo "\033[1;34m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD=" " +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" +THIN="discard=on,ssd=1," +SPINNER_PID="" +set -Eeuo pipefail +trap 'error_handler $LINENO "$BASH_COMMAND"' ERR +trap cleanup EXIT + +function error_handler() { + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + printf "\e[?25h" + local exit_code="$?" + local line_number="$1" + local command="$2" + local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" + echo -e "\n$error_message\n" + cleanup_vmid +} + +function cleanup_vmid() { + if qm status $VMID &>/dev/null; then + qm stop $VMID &>/dev/null + qm destroy $VMID &>/dev/null + fi +} + +function cleanup() { + popd >/dev/null + rm -rf $TEMP_DIR +} + +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +if whiptail --backtitle "Proxmox VE Helper Scripts" --title "HOME ASSISTANT OS VM" --yesno "This will create a New Home Assistant OS VM. Proceed?" 10 58; then + : +else + header_info && echo -e "⚠ User exited script \n" && exit +fi + +function spinner() { + local chars="/-\|" + local spin_i=0 + printf "\e[?25l" + while true; do + printf "\r \e[36m%s\e[0m" "${chars:spin_i++%${#chars}:1}" + sleep 0.1 + done +} + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg} " + spinner & + SPINNER_PID=$! +} + +function msg_ok() { + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + printf "\e[?25h" + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +function msg_error() { + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + printf "\e[?25h" + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +function check_root() { + if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then + clear + msg_error "Please run this script as root." + echo -e "\nExiting..." + sleep 2 + exit + fi +} + +function pve_check() { + if ! pveversion | grep -Eq "pve-manager/8.[1-3]"; then + msg_error "This version of Proxmox Virtual Environment is not supported" + echo -e "Requires Proxmox Virtual Environment Version 8.1 or later." + echo -e "Exiting..." + sleep 2 + exit +fi +} + +function arch_check() { + if [ "$(dpkg --print-architecture)" != "amd64" ]; then + msg_error "This script will not work with PiMox! \n" + echo -e "Exiting..." + sleep 2 + exit + fi +} + +function ssh_check() { + if command -v pveversion >/dev/null 2>&1; then + if [ -n "${SSH_CLIENT:+x}" ]; then + if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "SSH DETECTED" --yesno "It's suggested to use the Proxmox shell instead of SSH, since SSH can create issues while gathering variables. Would you like to proceed with using SSH?" 10 62; then + echo "you've been warned" + else + clear + exit + fi + fi + fi +} + +function exit-script() { + clear + echo -e "⚠ User exited script \n" + exit +} + +function default_settings() { + BRANCH="$stable" + VMID="$NEXTID" + FORMAT=",efitype=4m" + MACHINE="" + DISK_CACHE="cache=writethrough," + HN="haos$stable" + CPU_TYPE=" -cpu host" + CORE_COUNT="2" + RAM_SIZE="4096" + BRG="vmbr0" + MAC="$GEN_MAC" + VLAN="" + MTU="" + START_VM="yes" + echo -e "${DGN}Using HAOS Version: ${BGN}${BRANCH}${CL}" + echo -e "${DGN}Using Virtual Machine ID: ${BGN}${VMID}${CL}" + echo -e "${DGN}Using Machine Type: ${BGN}i440fx${CL}" + echo -e "${DGN}Using Disk Cache: ${BGN}Write Through${CL}" + echo -e "${DGN}Using Hostname: ${BGN}${HN}${CL}" + echo -e "${DGN}Using CPU Model: ${BGN}Host${CL}" + echo -e "${DGN}Allocated Cores: ${BGN}${CORE_COUNT}${CL}" + echo -e "${DGN}Allocated RAM: ${BGN}${RAM_SIZE}${CL}" + echo -e "${DGN}Using Bridge: ${BGN}${BRG}${CL}" + echo -e "${DGN}Using MAC Address: ${BGN}${MAC}${CL}" + echo -e "${DGN}Using VLAN: ${BGN}Default${CL}" + echo -e "${DGN}Using Interface MTU Size: ${BGN}Default${CL}" + echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}" + echo -e "${BL}Creating a HAOS VM using the above default settings${CL}" +} + +function advanced_settings() { + if BRANCH=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "HAOS VERSION" --radiolist "Choose Version" --cancel-button Exit-Script 10 58 3 \ + "$stable" "Stable " ON \ + "$beta" "Beta " OFF \ + "$dev" "Dev " OFF \ + 3>&1 1>&2 2>&3); then + echo -e "${DGN}Using HAOS Version: ${BGN}$BRANCH${CL}" + else + exit-script + fi + + while true; do + if VMID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Virtual Machine ID" 8 58 $NEXTID --title "VIRTUAL MACHINE ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z "$VMID" ]; then + VMID="$NEXTID" + fi + if pct status "$VMID" &>/dev/null || qm status "$VMID" &>/dev/null; then + echo -e "${CROSS}${RD} ID $VMID is already in use${CL}" + sleep 2 + continue + fi + echo -e "${DGN}Virtual Machine ID: ${BGN}$VMID${CL}" + break + else + exit-script + fi + done + + if MACH=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "MACHINE TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 10 58 2 \ + "i440fx" "Machine i440fx" ON \ + "q35" "Machine q35" OFF \ + 3>&1 1>&2 2>&3); then + if [ $MACH = q35 ]; then + echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" + FORMAT="" + MACHINE=" -machine q35" + else + echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" + FORMAT=",efitype=4m" + MACHINE="" + fi + else + exit-script + fi + + if DISK_CACHE1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DISK CACHE" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \ + "0" "None" OFF \ + "1" "Write Through (Default)" ON \ + 3>&1 1>&2 2>&3); then + if [ $DISK_CACHE1 = "1" ]; then + echo -e "${DGN}Using Disk Cache: ${BGN}Write Through${CL}" + DISK_CACHE="cache=writethrough," + else + echo -e "${DGN}Using Disk Cache: ${BGN}None${CL}" + DISK_CACHE="" + fi + else + exit-script + fi + + if VM_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 haos${BRANCH} --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VM_NAME ]; then + HN="haos${BRANCH}" + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + else + HN=$(echo ${VM_NAME,,} | tr -d ' ') + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + fi + else + exit-script + fi + + if CPU_TYPE1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CPU MODEL" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \ + "0" "KVM64" OFF \ + "1" "Host (Default)" ON \ + 3>&1 1>&2 2>&3); then + if [ $CPU_TYPE1 = "1" ]; then + echo -e "${DGN}Using CPU Model: ${BGN}Host${CL}" + CPU_TYPE=" -cpu host" + else + echo -e "${DGN}Using CPU Model: ${BGN}KVM64${CL}" + CPU_TYPE="" + fi + else + exit-script + fi + + if CORE_COUNT=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 2 --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $CORE_COUNT ]; then + CORE_COUNT="2" + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + else + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + fi + else + exit-script + fi + + if RAM_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 4096 --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $RAM_SIZE ]; then + RAM_SIZE="4096" + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + else + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + fi + else + exit-script + fi + + if BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $BRG ]; then + BRG="vmbr0" + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + else + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + fi + else + exit-script + fi + + if MAC1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a MAC Address" 8 58 $GEN_MAC --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MAC1 ]; then + MAC="$GEN_MAC" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC${CL}" + else + MAC="$MAC1" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + fi + else + exit-script + fi + + if VLAN1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VLAN1 ]; then + VLAN1="Default" + VLAN="" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + else + VLAN=",tag=$VLAN1" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + fi + else + exit-script + fi + + if MTU1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Interface MTU Size (leave blank for default)" 8 58 --title "MTU SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MTU1 ]; then + MTU1="Default" + MTU="" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + else + MTU=",mtu=$MTU1" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + fi + else + exit-script + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "START VIRTUAL MACHINE" --yesno "Start VM when completed?" 10 58); then + echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}" + START_VM="yes" + else + echo -e "${DGN}Start VM when completed: ${BGN}no${CL}" + START_VM="no" + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create HAOS ${BRANCH} VM?" --no-button Do-Over 10 58); then + echo -e "${RD}Creating a HAOS VM using the above advanced settings${CL}" + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +function start_script() { + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +check_root +arch_check +pve_check +ssh_check +start_script + +msg_info "Validating Storage" +while read -r line; do + TAG=$(echo $line | awk '{print $1}') + TYPE=$(echo $line | awk '{printf "%-10s", $2}') + FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') + ITEM=" Type: $TYPE Free: $FREE " + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + STORAGE_MENU+=("$TAG" "$ITEM" "OFF") +done < <(pvesm status -content images | awk 'NR>1') +VALID=$(pvesm status -content images | awk 'NR>1') +if [ -z "$VALID" ]; then + msg_error "Unable to detect a valid storage location." + exit +elif [ $((${#STORAGE_MENU[@]} / 3)) -eq 1 ]; then + STORAGE=${STORAGE_MENU[0]} +else + while [ -z "${STORAGE:+x}" ]; do + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + printf "\e[?25h" + STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \ + "Which storage pool you would like to use for ${HN}?\nTo make a selection, use the Spacebar.\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit + done +fi +msg_ok "Using ${CL}${BL}$STORAGE${CL} ${GN}for Storage Location." +msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}." +msg_info "Retrieving the URL for Home Assistant ${BRANCH} Disk Image" +if [ "$BRANCH" == "$dev" ]; then + URL=https://os-artifacts.home-assistant.io/${BRANCH}/haos_ova-${BRANCH}.qcow2.xz +else + URL=https://github.com/home-assistant/operating-system/releases/download/${BRANCH}/haos_ova-${BRANCH}.qcow2.xz +fi +sleep 2 +msg_ok "${CL}${BL}${URL}${CL}" +wget -q --show-progress $URL +echo -en "\e[1A\e[0K" +FILE=$(basename $URL) +msg_ok "Downloaded ${CL}${BL}haos_ova-${BRANCH}.qcow2.xz${CL}" +msg_info "Extracting KVM Disk Image" +unxz $FILE +STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') +case $STORAGE_TYPE in +nfs | dir) + DISK_EXT=".raw" + DISK_REF="$VMID/" + DISK_IMPORT="-format raw" + THIN="" + ;; +btrfs | local-zfs) + DISK_EXT=".raw" + DISK_REF="$VMID/" + DISK_IMPORT="-format raw" + FORMAT=",efitype=4m" + THIN="" + ;; +esac +for i in {0,1}; do + disk="DISK$i" + eval DISK${i}=vm-${VMID}-disk-${i}${DISK_EXT:-} + eval DISK${i}_REF=${STORAGE}:${DISK_REF:-}${!disk} +done +msg_ok "Extracted KVM Disk Image" +msg_info "Creating HAOS VM" +qm create $VMID -agent 1${MACHINE} -tablet 0 -localtime 1 -bios ovmf${CPU_TYPE} -cores $CORE_COUNT -memory $RAM_SIZE \ + -name $HN -tags proxmox-helper-scripts -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci +pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null +qm importdisk $VMID ${FILE%.*} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null +qm set $VMID \ + -efidisk0 ${DISK0_REF}${FORMAT} \ + -scsi0 ${DISK1_REF},${DISK_CACHE}${THIN}size=32G \ + -boot order=scsi0 \ + -description "
+ + # Home Assistant OS + + +
" >/dev/null +msg_ok "Created HAOS VM ${CL}${BL}(${HN})" +if [ "$START_VM" == "yes" ]; then + msg_info "Starting Home Assistant OS VM" + qm start $VMID + msg_ok "Started Home Assistant OS VM" +fi +msg_ok "Completed Successfully!\n" diff --git a/vm/mikrotik-routeros.sh b/vm/mikrotik-routeros.sh new file mode 100644 index 00000000..29b41892 --- /dev/null +++ b/vm/mikrotik-routeros.sh @@ -0,0 +1,285 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + cat <<"EOF" + __ ____ __ __ _ __ ____ __ ____ _____ ________ ______ + / |/ (_) /___________ / /_(_) /__ / __ \____ __ __/ /____ _____/ __ \/ ___/ / ____/ / / / __ \ + / /|_/ / / //_/ ___/ __ \/ __/ / //_/ / /_/ / __ \/ / / / __/ _ \/ ___/ / / /\__ \ / / / /_/ / /_/ / + / / / / / ,< / / / /_/ / /_/ / ,< / _, _/ /_/ / /_/ / /_/ __/ / / /_/ /___/ / / /___/ __ / _, _/ +/_/ /_/_/_/|_/_/ \____/\__/_/_/|_| /_/ |_|\____/\__,_/\__/\___/_/ \____//____/ \____/_/ /_/_/ |_| + +EOF +} +clear +header_info +echo -e "Loading..." +GEN_MAC=$(echo '00 60 2f'$(od -An -N3 -t xC /dev/urandom) | sed -e 's/ /:/g' | tr '[:lower:]' '[:upper:]') +NEXTID=$(pvesh get /cluster/nextid) +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +HA=$(echo "\033[1;34m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +trap cleanup EXIT +function error_exit() { + trap - ERR + local reason="Unknown failure occurred." + local msg="${1:-$reason}" + local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + [ ! -z ${VMID-} ] && cleanup_vmid + exit $EXIT +} +function cleanup_vmid() { + if $(qm status $VMID &>/dev/null); then + if [ "$(qm status $VMID | awk '{print $2}')" == "running" ]; then + qm stop $VMID + fi + qm destroy $VMID + fi +} +function cleanup() { + popd >/dev/null + rm -rf $TEMP_DIR +} +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +if ! pveversion | grep -Eq "pve-manager/8.[1-3]"; then + msg_error "This version of Proxmox Virtual Environment is not supported" + echo -e "Requires Proxmox Virtual Environment Version 8.1 or later." + echo -e "Exiting..." + sleep 2 + exit +fi +if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "Mikrotik RouterOS CHR VM" --yesno "This will create a New Mikrotik RouterOS CHR VM. Proceed?" 10 58); then + echo "User selected Yes" +else + clear + echo -e "⚠ User exited script \n" + exit +fi + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} +function default_settings() { + echo -e "${DGN}Using Virtual Machine ID: ${BGN}$NEXTID${CL}" + VMID=$NEXTID + echo -e "${DGN}Using Hostname: ${BGN}mikrotik-routeros-chr${CL}" + HN=mikrotik-routeros-chr + echo -e "${DGN}Allocated Cores: ${BGN}1${CL}" + CORE_COUNT="2" + echo -e "${DGN}Allocated RAM: ${BGN}256${CL}" + RAM_SIZE="512" + echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}" + BRG="vmbr0" + echo -e "${DGN}Using MAC Address: ${BGN}$GEN_MAC${CL}" + MAC=$GEN_MAC + echo -e "${DGN}Using VLAN: ${BGN}Default${CL}" + VLAN="" + echo -e "${DGN}Using Interface MTU Size: ${BGN}Default${CL}" + MTU="" + echo -e "${DGN}Start VM when completed: ${BGN}no${CL}" + START_VM="no" + echo -e "${BL}Creating a Mikrotik RouterOS CHR VM using the above default settings${CL}" +} +function advanced_settings() { + VMID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Virtual Machine ID" 8 58 $NEXTID --title "VIRTUAL MACHINE ID" 3>&1 1>&2 2>&3) + exitstatus=$? + if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Virtual Machine ID: ${BGN}$VMID${CL}" + else + exit + fi + VM_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 mikrotik-routeros-chr --title "HOSTNAME" 3>&1 1>&2 2>&3) + exitstatus=$? + if [ $exitstatus = 0 ]; then + HN=$(echo ${VM_NAME,,} | tr -d ' ') + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + else + exit + fi + CORE_COUNT=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 2 --title "CORE COUNT" 3>&1 1>&2 2>&3) + exitstatus=$? + if [ $exitstatus = 0 ]; then + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + else + exit + fi + RAM_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 512 --title "RAM" 3>&1 1>&2 2>&3) + exitstatus=$? + if [ $exitstatus = 0 ]; then + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + else + exit + fi + BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) + exitstatus=$? + if [ $exitstatus = 0 ]; then + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + else + exit + fi + MAC1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a MAC Address" 8 58 $GEN_MAC --title "MAC ADDRESS" 3>&1 1>&2 2>&3) + exitstatus=$? + if [ $exitstatus = 0 ]; then + MAC="$MAC1" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + else + exit + fi + VLAN1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 3>&1 1>&2 2>&3) + exitstatus=$? + if [ $exitstatus = 0 ]; then + if [ -z $VLAN1 ]; then + VLAN1="Default" VLAN="" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + else + VLAN=",tag=$VLAN1" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + fi + fi + MTU1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Interface MTU Size (leave blank for default)" 8 58 --title "MTU SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3) + exitstatus=$? + if [ $exitstatus = 0 ]; then + if [ -z $MTU1 ]; then + MTU1="Default" MTU="" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + else + MTU=",mtu=$MTU1" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + fi + fi + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "START VIRTUAL MACHINE" --yesno "Start Mikrotik RouterOS CHR VM when completed?" 10 58); then + echo -e "${DGN}Start Mikrotik RouterOS CHR VM when completed: ${BGN}yes${CL}" + START_VM="yes" + else + echo -e "${DGN}Start Mikrotik RouterOS CHR VM when completed: ${BGN}no${CL}" + START_VM="no" + fi + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create Mikrotik RouterOS VM?" 10 58); then + echo -e "${RD}Creating Mikrotik RouterOS CHR VM using the above advanced settings${CL}" + else + clear + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} +function start_script() { + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then + clear + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings + else + clear + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} +start_script +msg_info "Validating Storage" +while read -r line; do + TAG=$(echo $line | awk '{print $1}') + TYPE=$(echo $line | awk '{printf "%-10s", $2}') + FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') + ITEM=" Type: $TYPE Free: $FREE " + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + STORAGE_MENU+=("$TAG" "$ITEM" "OFF") +done < <(pvesm status -content images | awk 'NR>1') +VALID=$(pvesm status -content images | awk 'NR>1') +if [ -z "$VALID" ]; then + echo -e "\n${RD}⚠ Unable to detect a valid storage location.${CL}" + echo -e "Exiting..." + exit +elif [ $((${#STORAGE_MENU[@]} / 3)) -eq 1 ]; then + STORAGE=${STORAGE_MENU[0]} +else + while [ -z "${STORAGE:+x}" ]; do + STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \ + "Which storage pool you would like to use for the Mikrotik RouterOS CHR VM?\n\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit + done +fi +msg_ok "Using ${CL}${BL}$STORAGE${CL} ${GN}for Storage Location." +msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}." +msg_info "Getting URL for Mikrotik RouterOS CHR Disk Image" + +URL=https://download.mikrotik.com/routeros/7.15.2/chr-7.15.2.img.zip + +sleep 2 +msg_ok "${CL}${BL}${URL}${CL}" +wget -q --show-progress $URL +echo -en "\e[1A\e[0K" +FILE=$(basename $URL) +msg_ok "Downloaded ${CL}${BL}$FILE${CL}" +msg_info "Extracting Mikrotik RouterOS CHR Disk Image" +gunzip -f -S .zip $FILE +STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') +case $STORAGE_TYPE in +nfs | dir) + DISK_EXT=".qcow2" + DISK_REF="$VMID/" + DISK_IMPORT="-format qcow2" + ;; +btrfs | zfspool) + DISK_EXT="" + DISK_REF="$VMID/" + DISK_IMPORT="-format raw" + ;; +esac + +DISK_VAR="vm-${VMID}-disk-0${DISK_EXT:-}" +DISK_REF="${STORAGE}:${DISK_REF:-}${DISK_VAR:-}" + +msg_ok "Extracted Mikrotik RouterOS CHR Disk Image" +msg_info "Creating Mikrotik RouterOS CHR VM" +qm create $VMID -tablet 0 -localtime 1 -cores $CORE_COUNT -memory $RAM_SIZE -name $HN \ + -tags proxmox-helper-scripts -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU \ + -onboot 1 -ostype l26 -scsihw virtio-scsi-pci +qm importdisk $VMID ${FILE%.*} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null +qm set $VMID \ + -scsi0 "$DISK_REF" \ + -boot order=scsi0 \ + -description "
+ + # Mikrotik RouterOS CHR + + +
" >/dev/null +msg_ok "Mikrotik RouterOS CHR VM ${CL}${BL}(${HN})" +if [ "$START_VM" == "yes" ]; then + msg_info "Starting Mikrotik RouterOS CHR VM" + qm start $VMID + msg_ok "Started Mikrotik RouterOS CHR VM" +fi +msg_ok "Completed Successfully!\n" diff --git a/vm/nextcloud-vm.sh b/vm/nextcloud-vm.sh new file mode 100644 index 00000000..1e50c37d --- /dev/null +++ b/vm/nextcloud-vm.sh @@ -0,0 +1,423 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + ______ __ __ _ __ __ __ _ ____ ___ +/_ __/_ _________ / //_/__ __ __ / |/ /____ ______/ /__ __ _____/ / | | / / |/ / + / / / // / __/ _ \/ ,< / -_) // / / / -_) \ / __/ / _ \/ // / _ / | |/ / /|_/ / +/_/ \_,_/_/ /_//_/_/|_|\__/\_, / /_/|_/\__/_\_\\__/_/\___/\_,_/\_,_/ |___/_/ /_/ + /___/ +EOF +} +header_info +echo -e "\n Loading..." +GEN_MAC=02:$(openssl rand -hex 5 | awk '{print toupper($0)}' | sed 's/\(..\)/\1:/g; s/.$//') +NEXTID=$(pvesh get /cluster/nextid) +NAME="TurnKey Nexcloud VM" +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +HA=$(echo "\033[1;34m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" +THIN="discard=on,ssd=1," +set -e +trap 'error_handler $LINENO "$BASH_COMMAND"' ERR +trap cleanup EXIT +function error_handler() { + local exit_code="$?" + local line_number="$1" + local command="$2" + local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" + echo -e "\n$error_message\n" + cleanup_vmid +} + +function cleanup_vmid() { + if qm status $VMID &>/dev/null; then + qm stop $VMID &>/dev/null + qm destroy $VMID &>/dev/null + fi +} + +function cleanup() { + popd >/dev/null + rm -rf $TEMP_DIR +} + +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +if whiptail --backtitle "Proxmox VE Helper Scripts" --title "$NAME" --yesno "This will create a New $NAME. Proceed?" 10 58; then + : +else + header_info && echo -e "⚠ User exited script \n" && exit +fi + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +function check_root() { + if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then + clear + msg_error "Please run this script as root." + echo -e "\nExiting..." + sleep 2 + exit + fi +} + +function pve_check() { + if ! pveversion | grep -Eq "pve-manager/8.[1-3]"; then + msg_error "This version of Proxmox Virtual Environment is not supported" + echo -e "Requires Proxmox Virtual Environment Version 8.1 or later." + echo -e "Exiting..." + sleep 2 + exit +fi +} + +function arch_check() { + if [ "$(dpkg --print-architecture)" != "amd64" ]; then + msg_error "This script will not work with PiMox! \n" + echo -e "Exiting..." + sleep 2 + exit + fi +} + +function ssh_check() { + if command -v pveversion >/dev/null 2>&1; then + if [ -n "${SSH_CLIENT:+x}" ]; then + if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "SSH DETECTED" --yesno "It's suggested to use the Proxmox shell instead of SSH, since SSH can create issues while gathering variables. Would you like to proceed with using SSH?" 10 62; then + echo "you've been warned" + else + clear + exit + fi + fi + fi +} + +function exit-script() { + clear + echo -e "⚠ User exited script \n" + exit +} + +function default_settings() { + VMID="$NEXTID" + FORMAT=",efitype=4m" + MACHINE="" + DISK_CACHE="" + HN="turnkey-nextcloud-vm" + CPU_TYPE="" + CORE_COUNT="2" + RAM_SIZE="2048" + BRG="vmbr0" + MAC="$GEN_MAC" + VLAN="" + MTU="" + START_VM="no" + echo -e "${DGN}Using Virtual Machine ID: ${BGN}${VMID}${CL}" + echo -e "${DGN}Using Machine Type: ${BGN}i440fx${CL}" + echo -e "${DGN}Using Disk Cache: ${BGN}None${CL}" + echo -e "${DGN}Using Hostname: ${BGN}${HN}${CL}" + echo -e "${DGN}Using CPU Model: ${BGN}KVM64${CL}" + echo -e "${DGN}Allocated Cores: ${BGN}${CORE_COUNT}${CL}" + echo -e "${DGN}Allocated RAM: ${BGN}${RAM_SIZE}${CL}" + echo -e "${DGN}Using Bridge: ${BGN}${BRG}${CL}" + echo -e "${DGN}Using MAC Address: ${BGN}${MAC}${CL}" + echo -e "${DGN}Using VLAN: ${BGN}Default${CL}" + echo -e "${DGN}Using Interface MTU Size: ${BGN}Default${CL}" + echo -e "${DGN}Start VM when completed: ${BGN}no${CL}" + echo -e "${BL}Creating a $NAME using the above default settings${CL}" +} + +function advanced_settings() { + while true; do + if VMID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Virtual Machine ID" 8 58 $NEXTID --title "VIRTUAL MACHINE ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z "$VMID" ]; then + VMID="$NEXTID" + fi + if pct status "$VMID" &>/dev/null || qm status "$VMID" &>/dev/null; then + echo -e "${CROSS}${RD} ID $VMID is already in use${CL}" + sleep 2 + continue + fi + echo -e "${DGN}Virtual Machine ID: ${BGN}$VMID${CL}" + break + else + exit-script + fi + done + + if MACH=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "MACHINE TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 10 58 2 \ + "i440fx" "Machine i440fx" ON \ + "q35" "Machine q35" OFF \ + 3>&1 1>&2 2>&3); then + if [ $MACH = q35 ]; then + echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" + FORMAT="" + MACHINE=" -machine q35" + else + echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" + FORMAT=",efitype=4m" + MACHINE="" + fi + else + exit-script + fi + + if DISK_CACHE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DISK CACHE" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \ + "0" "None (Default)" ON \ + "1" "Write Through" OFF \ + 3>&1 1>&2 2>&3); then + if [ $DISK_CACHE = "1" ]; then + echo -e "${DGN}Using Disk Cache: ${BGN}Write Through${CL}" + DISK_CACHE="cache=writethrough," + else + echo -e "${DGN}Using Disk Cache: ${BGN}None${CL}" + DISK_CACHE="" + fi + else + exit-script + fi + + if VM_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 $HN --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VM_NAME ]; then + HN="$HN" + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + else + HN=$(echo ${VM_NAME,,} | tr -d ' ') + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + fi + else + exit-script + fi + + if CPU_TYPE1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CPU MODEL" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \ + "0" "KVM64 (Default)" ON \ + "1" "Host" OFF \ + 3>&1 1>&2 2>&3); then + if [ $CPU_TYPE1 = "1" ]; then + echo -e "${DGN}Using CPU Model: ${BGN}Host${CL}" + CPU_TYPE=" -cpu host" + else + echo -e "${DGN}Using CPU Model: ${BGN}KVM64${CL}" + CPU_TYPE="" + fi + else + exit-script + fi + + if CORE_COUNT=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 2 --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $CORE_COUNT ]; then + CORE_COUNT="2" + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + else + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + fi + else + exit-script + fi + + if RAM_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 2048 --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $RAM_SIZE ]; then + RAM_SIZE="2048" + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + else + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + fi + else + exit-script + fi + + if BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $BRG ]; then + BRG="vmbr0" + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + else + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + fi + else + exit-script + fi + + if MAC1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a MAC Address" 8 58 $GEN_MAC --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MAC1 ]; then + MAC="$GEN_MAC" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC${CL}" + else + MAC="$MAC1" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + fi + else + exit-script + fi + + if VLAN1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VLAN1 ]; then + VLAN1="Default" + VLAN="" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + else + VLAN=",tag=$VLAN1" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + fi + else + exit-script + fi + + if MTU1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Interface MTU Size (leave blank for default)" 8 58 --title "MTU SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MTU1 ]; then + MTU1="Default" + MTU="" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + else + MTU=",mtu=$MTU1" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + fi + else + exit-script + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "START VIRTUAL MACHINE" --yesno "Start VM when completed?" 10 58); then + echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}" + START_VM="yes" + else + echo -e "${DGN}Start VM when completed: ${BGN}no${CL}" + START_VM="no" + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create a $NAME?" --no-button Do-Over 10 58); then + echo -e "${RD}Creating a $NAME using the above advanced settings${CL}" + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +function start_script() { + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +check_root +arch_check +pve_check +ssh_check +start_script + +msg_info "Validating Storage" +while read -r line; do + TAG=$(echo $line | awk '{print $1}') + TYPE=$(echo $line | awk '{printf "%-10s", $2}') + FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') + ITEM=" Type: $TYPE Free: $FREE " + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + STORAGE_MENU+=("$TAG" "$ITEM" "OFF") +done < <(pvesm status -content images | awk 'NR>1') +VALID=$(pvesm status -content images | awk 'NR>1') +if [ -z "$VALID" ]; then + msg_error "Unable to detect a valid storage location." + exit +elif [ $((${#STORAGE_MENU[@]} / 3)) -eq 1 ]; then + STORAGE=${STORAGE_MENU[0]} +else + while [ -z "${STORAGE:+x}" ]; do + STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \ + "Which storage pool you would like to use for ${HN}?\nTo make a selection, use the Spacebar.\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit + done +fi +msg_ok "Using ${CL}${BL}$STORAGE${CL} ${GN}for Storage Location." +msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}." +msg_info "Retrieving the URL for the $NAME Disk Image" +URL=http://mirror.turnkeylinux.org/turnkeylinux/images/iso/turnkey-nextcloud-18.0-bookworm-amd64.iso +sleep 2 +msg_ok "${CL}${BL}${URL}${CL}" +wget -q --show-progress $URL +echo -en "\e[1A\e[0K" +FILE=$(basename $URL) +msg_ok "Downloaded ${CL}${BL}${FILE}${CL}" + +STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') +case $STORAGE_TYPE in +nfs | dir) + DISK_EXT=".raw" + DISK_REF="$VMID/" + DISK_IMPORT="-format raw" + THIN="" + ;; +btrfs) + DISK_EXT=".raw" + DISK_REF="$VMID/" + DISK_IMPORT="-format raw" + FORMAT=",efitype=4m" + THIN="" + ;; +esac +for i in {0,1}; do + disk="DISK$i" + eval DISK${i}=vm-${VMID}-disk-${i}${DISK_EXT:-} + eval DISK${i}_REF=${STORAGE}:${DISK_REF:-}${!disk} +done + +msg_info "Creating a $NAME" +qm create $VMID -agent 1${MACHINE} -tablet 0 -localtime 1 -bios seabios${CPU_TYPE} -cores $CORE_COUNT -memory $RAM_SIZE \ + -name $HN -tags proxmox-helper-scripts -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci +pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null +qm importdisk $VMID ${FILE} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null +qm set $VMID \ + -efidisk0 ${DISK0_REF}${FORMAT} \ + -scsi0 ${DISK1_REF},${DISK_CACHE}${THIN}size=12G \ + -boot order=scsi0 \ + -description "
+ + # $NAME + + +
" >/dev/null +msg_ok "Created a $NAME ${CL}${BL}(${HN})" +if [ "$START_VM" == "yes" ]; then + msg_info "Starting $NAME" + qm start $VMID + msg_ok "Started $NAME" +fi +msg_ok "Completed Successfully!\n" diff --git a/vm/openwrt.sh b/vm/openwrt.sh new file mode 100644 index 00000000..3cdd38f3 --- /dev/null +++ b/vm/openwrt.sh @@ -0,0 +1,523 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Jon Spriggs (jontheniceguy) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +# Based on work from https://i12bretro.github.io/tutorials/0405.html + +function header_info { + clear + cat <<"EOF" + ____ _ __ __ + / __ \____ ___ ____| | / /____/ /_ + / / / / __ \/ _ \/ __ \ | /| / / ___/ __/ +/ /_/ / /_/ / __/ / / / |/ |/ / / / /_ +\____/ .___/\___/_/ /_/|__/|__/_/ \__/ + /_/ W I R E L E S S F R E E D O M + +EOF +} +header_info +echo -e "Loading..." +GEN_MAC=02:$(openssl rand -hex 5 | awk '{print toupper($0)}' | sed 's/\(..\)/\1:/g; s/.$//') +GEN_MAC_LAN=02:$(openssl rand -hex 5 | awk '{print toupper($0)}' | sed 's/\(..\)/\1:/g; s/.$//') +NEXTID=$(pvesh get /cluster/nextid) +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +HA=$(echo "\033[1;34m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" +set -Eeo pipefail +trap 'error_handler $LINENO "$BASH_COMMAND"' ERR +trap cleanup EXIT +function error_handler() { + local exit_code="$?" + local line_number="$1" + local command="$2" + local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" + echo -e "\n$error_message\n" + cleanup_vmid +} + +function cleanup_vmid() { + if qm status $VMID &>/dev/null; then + qm stop $VMID &>/dev/null + qm destroy $VMID &>/dev/null + fi +} + +function cleanup() { + popd >/dev/null + rm -rf $TEMP_DIR +} + +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +function send_line_to_vm() { + echo -e "${DGN}Sending line: ${YW}$1${CL}" + for ((i = 0; i < ${#1}; i++)); do + character=${1:i:1} + case $character in + " ") character="spc" ;; + "-") character="minus" ;; + "=") character="equal" ;; + ",") character="comma" ;; + ".") character="dot" ;; + "/") character="slash" ;; + "'") character="apostrophe" ;; + ";") character="semicolon" ;; + '\') character="backslash" ;; + '`') character="grave_accent" ;; + "[") character="bracket_left" ;; + "]") character="bracket_right" ;; + "_") character="shift-minus" ;; + "+") character="shift-equal" ;; + "?") character="shift-slash" ;; + "<") character="shift-comma" ;; + ">") character="shift-dot" ;; + '"') character="shift-apostrophe" ;; + ":") character="shift-semicolon" ;; + "|") character="shift-backslash" ;; + "~") character="shift-grave_accent" ;; + "{") character="shift-bracket_left" ;; + "}") character="shift-bracket_right" ;; + "A") character="shift-a" ;; + "B") character="shift-b" ;; + "C") character="shift-c" ;; + "D") character="shift-d" ;; + "E") character="shift-e" ;; + "F") character="shift-f" ;; + "G") character="shift-g" ;; + "H") character="shift-h" ;; + "I") character="shift-i" ;; + "J") character="shift-j" ;; + "K") character="shift-k" ;; + "L") character="shift-l" ;; + "M") character="shift-m" ;; + "N") character="shift-n" ;; + "O") character="shift-o" ;; + "P") character="shift-p" ;; + "Q") character="shift-q" ;; + "R") character="shift-r" ;; + "S") character="shift-s" ;; + "T") character="shift-t" ;; + "U") character="shift-u" ;; + "V") character="shift-v" ;; + "W") character="shift-w" ;; + "X") character="shift=x" ;; + "Y") character="shift-y" ;; + "Z") character="shift-z" ;; + "!") character="shift-1" ;; + "@") character="shift-2" ;; + "#") character="shift-3" ;; + '$') character="shift-4" ;; + "%") character="shift-5" ;; + "^") character="shift-6" ;; + "&") character="shift-7" ;; + "*") character="shift-8" ;; + "(") character="shift-9" ;; + ")") character="shift-0" ;; + esac + qm sendkey $VMID "$character" + done + qm sendkey $VMID ret +} + +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null + +if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "OpenWrt VM" --yesno "This will create a New OpenWrt VM. Proceed?" 10 58); then + : +else + header_info && echo -e "⚠ User exited script \n" && exit +fi + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +function pve_check() { + if ! pveversion | grep -Eq "pve-manager/8.[1-3]"; then + msg_error "This version of Proxmox Virtual Environment is not supported" + echo -e "Requires Proxmox Virtual Environment Version 8.1 or later." + echo -e "Exiting..." + sleep 2 + exit +fi +} + +function arch_check() { + if [ "$(dpkg --print-architecture)" != "amd64" ]; then + echo -e "\n ${CROSS} This script will not work with PiMox! \n" + echo -e "Exiting..." + sleep 2 + exit + fi +} + +function ssh_check() { + if command -v pveversion >/dev/null 2>&1; then + if [ -n "${SSH_CLIENT:+x}" ]; then + if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "SSH DETECTED" --yesno "It's suggested to use the Proxmox shell instead of SSH, since SSH can create issues while gathering variables. Would you like to proceed with using SSH?" 10 62; then + echo "you've been warned" + else + clear + exit + fi + fi + fi +} + +function exit-script() { + clear + echo -e "⚠ User exited script \n" + exit +} + +function default_settings() { + VMID=$NEXTID + HN=openwrt + CORE_COUNT="1" + RAM_SIZE="256" + BRG="vmbr0" + VLAN="" + MAC=$GEN_MAC + LAN_MAC=$GEN_MAC_LAN + LAN_BRG="vmbr0" + LAN_IP_ADDR="192.168.1.1" + LAN_NETMASK="255.255.255.0" + LAN_VLAN=",tag=999" + MTU="" + START_VM="yes" + echo -e "${DGN}Using Virtual Machine ID: ${BGN}${VMID}${CL}" + echo -e "${DGN}Using Hostname: ${BGN}${HN}${CL}" + echo -e "${DGN}Allocated Cores: ${BGN}${CORE_COUNT}${CL}" + echo -e "${DGN}Allocated RAM: ${BGN}${RAM_SIZE}${CL}" + echo -e "${DGN}Using WAN Bridge: ${BGN}${BRG}${CL}" + echo -e "${DGN}Using WAN VLAN: ${BGN}Default${CL}" + echo -e "${DGN}Using WAN MAC Address: ${BGN}${MAC}${CL}" + echo -e "${DGN}Using LAN MAC Address: ${BGN}${LAN_MAC}${CL}" + echo -e "${DGN}Using LAN Bridge: ${BGN}${LAN_BRG}${CL}" + echo -e "${DGN}Using LAN VLAN: ${BGN}999${CL}" + echo -e "${DGN}Using LAN IP Address: ${BGN}${LAN_IP_ADDR}${CL}" + echo -e "${DGN}Using LAN NETMASK: ${BGN}${LAN_NETMASK}${CL}" + echo -e "${DGN}Using Interface MTU Size: ${BGN}Default${CL}" + echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}" + echo -e "${BL}Creating a OpenWRT VM using the above default settings${CL}" +} + +function advanced_settings() { + while true; do + if VMID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Virtual Machine ID" 8 58 $NEXTID --title "VIRTUAL MACHINE ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z "$VMID" ]; then + VMID="$NEXTID" + fi + if pct status "$VMID" &>/dev/null || qm status "$VMID" &>/dev/null; then + echo -e "${CROSS}${RD} ID $VMID is already in use${CL}" + sleep 2 + continue + fi + echo -e "${DGN}Virtual Machine ID: ${BGN}$VMID${CL}" + break + else + exit-script + fi + done + + if VM_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 openwrt --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VM_NAME ]; then + HN="openwrt" + else + HN=$(echo ${VM_NAME,,} | tr -d ' ') + fi + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + else + exit-script + fi + + if CORE_COUNT=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 1 --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $CORE_COUNT ]; then + CORE_COUNT="1" + fi + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + else + exit-script + fi + + if RAM_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 256 --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $RAM_SIZE ]; then + RAM_SIZE="256" + fi + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + else + exit-script + fi + + if BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a WAN Bridge" 8 58 vmbr0 --title "WAN BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $BRG ]; then + BRG="vmbr0" + fi + echo -e "${DGN}Using WAN Bridge: ${BGN}$BRG${CL}" + else + exit-script + fi + + if LAN_BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a LAN Bridge" 8 58 vmbr0 --title "LAN BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $LAN_BRG ]; then + LAN_BRG="vmbr0" + fi + echo -e "${DGN}Using LAN Bridge: ${BGN}$LAN_BRG${CL}" + else + exit-script + fi + + if LAN_IP_ADDR=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a router IP" 8 58 $LAN_IP_ADDR --title "LAN IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $LAN_IP_ADDR ]; then + LAN_IP_ADDR="192.168.1.1" + fi + echo -e "${DGN}Using LAN IP ADDRESS: ${BGN}$LAN_IP_ADDR${CL}" + else + exit-script + fi + + if LAN_NETMASK=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a router netmmask" 8 58 $LAN_NETMASK --title "LAN NETMASK" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $LAN_NETMASK ]; then + LAN_NETMASK="255.255.255.0" + fi + echo -e "${DGN}Using LAN NETMASK: ${BGN}$LAN_NETMASK${CL}" + else + exit-script + fi + + if MAC1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a WAN MAC Address" 8 58 $GEN_MAC --title "WAN MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MAC1 ]; then + MAC="$GEN_MAC" + else + MAC="$MAC1" + fi + echo -e "${DGN}Using WAN MAC Address: ${BGN}$MAC${CL}" + else + exit-script + fi + + if MAC2=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a LAN MAC Address" 8 58 $GEN_MAC_LAN --title "LAN MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MAC2 ]; then + LAN_MAC="$GEN_MAC_LAN" + else + LAN_MAC="$MAC2" + fi + echo -e "${DGN}Using LAN MAC Address: ${BGN}$LAN_MAC${CL}" + else + exit-script + fi + + if VLAN1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a WAN Vlan (leave blank for default)" 8 58 --title "WAN VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VLAN1 ]; then + VLAN1="Default" + VLAN="" + else + VLAN=",tag=$VLAN1" + fi + echo -e "${DGN}Using WAN Vlan: ${BGN}$VLAN1${CL}" + else + exit-script + fi + + if VLAN2=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a LAN Vlan" 8 58 999 --title "LAN VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VLAN2 ]; then + VLAN2="999" + LAN_VLAN=",tag=$VLAN2" + else + LAN_VLAN=",tag=$VLAN2" + fi + echo -e "${DGN}Using LAN Vlan: ${BGN}$VLAN2${CL}" + else + exit-script + fi + + if MTU1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Interface MTU Size (leave blank for default)" 8 58 --title "MTU SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MTU1 ]; then + MTU1="Default" + MTU="" + else + MTU=",mtu=$MTU1" + fi + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + else + exit-script + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "START VIRTUAL MACHINE" --yesno "Start VM when completed?" 10 58); then + START_VM="yes" + else + START_VM="no" + fi + echo -e "${DGN}Start VM when completed: ${BGN}$START_VM${CL}" + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create OpenWrt VM?" --no-button Do-Over 10 58); then + echo -e "${RD}Creating a OpenWrt VM using the above advanced settings${CL}" + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +function start_script() { + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +arch_check +pve_check +ssh_check +start_script + +msg_info "Validating Storage" +while read -r line; do + TAG=$(echo $line | awk '{print $1}') + TYPE=$(echo $line | awk '{printf "%-10s", $2}') + FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') + ITEM=" Type: $TYPE Free: $FREE " + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + STORAGE_MENU+=("$TAG" "$ITEM" "OFF") +done < <(pvesm status -content images | awk 'NR>1') +VALID=$(pvesm status -content images | awk 'NR>1') +if [ -z "$VALID" ]; then + echo -e "\n${RD}⚠ Unable to detect a valid storage location.${CL}" + echo -e "Exiting..." + exit +elif [ $((${#STORAGE_MENU[@]} / 3)) -eq 1 ]; then + STORAGE=${STORAGE_MENU[0]} +else + while [ -z "${STORAGE:+x}" ]; do + STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \ + "Which storage pool you would like to use for the OpenWrt VM?\n\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit + done +fi +msg_ok "Using ${CL}${BL}$STORAGE${CL} ${GN}for Storage Location." +msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}." +msg_info "Getting URL for OpenWrt Disk Image" + +response=$(curl -s https://openwrt.org) +stableversion=$(echo "$response" | sed -n 's/.*Current stable release - OpenWrt \([0-9.]\+\).*/\1/p') +URL="https://downloads.openwrt.org/releases/$stableversion/targets/x86/64/openwrt-$stableversion-x86-64-generic-ext4-combined.img.gz" + +sleep 2 +msg_ok "${CL}${BL}${URL}${CL}" +wget -q --show-progress $URL +echo -en "\e[1A\e[0K" +FILE=$(basename $URL) +msg_ok "Downloaded ${CL}${BL}$FILE${CL}" +gunzip -f $FILE >/dev/null 2>/dev/null || true +NEWFILE="${FILE%.*}" +FILE="$NEWFILE" +mv $FILE ${FILE%.*} +qemu-img resize -f raw ${FILE%.*} 512M >/dev/null 2>/dev/null +msg_ok "Extracted & Resized OpenWrt Disk Image ${CL}${BL}$FILE${CL}" +STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') +case $STORAGE_TYPE in +nfs | dir) + DISK_EXT=".qcow2" + DISK_REF="$VMID/" + DISK_IMPORT="-format qcow2" + ;; +btrfs) + DISK_EXT=".raw" + DISK_REF="$VMID/" + DISK_IMPORT="-format raw" + ;; +esac +for i in {0,1}; do + disk="DISK$i" + eval DISK${i}=vm-${VMID}-disk-${i}${DISK_EXT:-} + eval DISK${i}_REF=${STORAGE}:${DISK_REF:-}${!disk} +done + +msg_info "Creating OpenWrt VM" +qm create $VMID -cores $CORE_COUNT -memory $RAM_SIZE -name $HN \ + -onboot 1 -ostype l26 -scsihw virtio-scsi-pci --tablet 0 +pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null +qm importdisk $VMID ${FILE%.*} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null +qm set $VMID \ + -efidisk0 ${DISK0_REF},efitype=4m,size=4M \ + -scsi0 ${DISK1_REF},size=512M \ + -boot order=scsi0 \ + -tags proxmox-helper-scripts \ + -description "
+ + # OpenWRT + + +
" >/dev/null +msg_ok "Created OpenWrt VM ${CL}${BL}(${HN})" +msg_info "OpenWrt is being started in order to configure the network interfaces." +qm start $VMID +sleep 15 +msg_ok "Network interfaces are being configured as OpenWrt initiates." +send_line_to_vm "" +send_line_to_vm "uci delete network.@device[0]" +send_line_to_vm "uci set network.wan=interface" +send_line_to_vm "uci set network.wan.device=eth1" +send_line_to_vm "uci set network.wan.proto=dhcp" +send_line_to_vm "uci delete network.lan" +send_line_to_vm "uci set network.lan=interface" +send_line_to_vm "uci set network.lan.device=eth0" +send_line_to_vm "uci set network.lan.proto=static" +send_line_to_vm "uci set network.lan.ipaddr=${LAN_IP_ADDR}" +send_line_to_vm "uci set network.lan.netmask=${LAN_NETMASK}" +send_line_to_vm "uci set firewall.@zone[1].input='ACCEPT'" +send_line_to_vm "uci set firewall.@zone[1].forward='ACCEPT'" +send_line_to_vm "uci commit" +send_line_to_vm "halt" +msg_ok "Network interfaces have been successfully configured." +until qm status $VMID | grep -q "stopped"; do + sleep 2 +done +msg_info "Bridge interfaces are being added." +qm set $VMID \ + -net0 virtio,bridge=${LAN_BRG},macaddr=${LAN_MAC}${LAN_VLAN}${MTU} \ + -net1 virtio,bridge=${BRG},macaddr=${MAC}${VLAN}${MTU} >/dev/null 2>/dev/null +msg_ok "Bridge interfaces have been successfully added." +if [ "$START_VM" == "yes" ]; then + msg_info "Starting OpenWrt VM" + qm start $VMID + msg_ok "Started OpenWrt VM" +fi +VLAN_FINISH="" +if [ "$VLAN" == "" ] && [ "$VLAN2" != "999" ]; then + VLAN_FINISH=" Please remember to adjust the VLAN tags to suit your network." +fi +msg_ok "Completed Successfully!\n${VLAN_FINISH}" diff --git a/vm/owncloud-vm.sh b/vm/owncloud-vm.sh new file mode 100644 index 00000000..871f5eeb --- /dev/null +++ b/vm/owncloud-vm.sh @@ -0,0 +1,423 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + ______ __ __ _______ __ _ ____ ___ +/_ __/_ _________ / //_/__ __ __ ___ _ _____ / ___/ /__ __ _____/ / | | / / |/ / + / / / // / __/ _ \/ ,< / -_) // / / _ \ |/|/ / _ \/ /__/ / _ \/ // / _ / | |/ / /|_/ / +/_/ \_,_/_/ /_//_/_/|_|\__/\_, / \___/__,__/_//_/\___/_/\___/\_,_/\_,_/ |___/_/ /_/ + /___/ +EOF +} +header_info +echo -e "\n Loading..." +GEN_MAC=02:$(openssl rand -hex 5 | awk '{print toupper($0)}' | sed 's/\(..\)/\1:/g; s/.$//') +NEXTID=$(pvesh get /cluster/nextid) + +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +HA=$(echo "\033[1;34m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" +THIN="discard=on,ssd=1," +set -e +trap 'error_handler $LINENO "$BASH_COMMAND"' ERR +trap cleanup EXIT +function error_handler() { + local exit_code="$?" + local line_number="$1" + local command="$2" + local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" + echo -e "\n$error_message\n" + cleanup_vmid +} + +function cleanup_vmid() { + if qm status $VMID &>/dev/null; then + qm stop $VMID &>/dev/null + qm destroy $VMID &>/dev/null + fi +} + +function cleanup() { + popd >/dev/null + rm -rf $TEMP_DIR +} + +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +if whiptail --backtitle "Proxmox VE Helper Scripts" --title "TurnKey-ownCloud VM" --yesno "This will create a New TurnKey-ownCloud VM. Proceed?" 10 58; then + : +else + header_info && echo -e "⚠ User exited script \n" && exit +fi + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +function check_root() { + if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then + clear + msg_error "Please run this script as root." + echo -e "\nExiting..." + sleep 2 + exit + fi +} + +function pve_check() { + if ! pveversion | grep -Eq "pve-manager/8.[1-3]"; then + msg_error "This version of Proxmox Virtual Environment is not supported" + echo -e "Requires Proxmox Virtual Environment Version 8.1 or later." + echo -e "Exiting..." + sleep 2 + exit +fi +} + +function arch_check() { + if [ "$(dpkg --print-architecture)" != "amd64" ]; then + msg_error "This script will not work with PiMox! \n" + echo -e "Exiting..." + sleep 2 + exit + fi +} + +function ssh_check() { + if command -v pveversion >/dev/null 2>&1; then + if [ -n "${SSH_CLIENT:+x}" ]; then + if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "SSH DETECTED" --yesno "It's suggested to use the Proxmox shell instead of SSH, since SSH can create issues while gathering variables. Would you like to proceed with using SSH?" 10 62; then + echo "you've been warned" + else + clear + exit + fi + fi + fi +} + +function exit-script() { + clear + echo -e "⚠ User exited script \n" + exit +} + +function default_settings() { + VMID="$NEXTID" + FORMAT=",efitype=4m" + MACHINE="" + DISK_CACHE="" + HN="turnkey-owncloud-vm" + CPU_TYPE="" + CORE_COUNT="2" + RAM_SIZE="2048" + BRG="vmbr0" + MAC="$GEN_MAC" + VLAN="" + MTU="" + START_VM="no" + echo -e "${DGN}Using Virtual Machine ID: ${BGN}${VMID}${CL}" + echo -e "${DGN}Using Machine Type: ${BGN}i440fx${CL}" + echo -e "${DGN}Using Disk Cache: ${BGN}None${CL}" + echo -e "${DGN}Using Hostname: ${BGN}${HN}${CL}" + echo -e "${DGN}Using CPU Model: ${BGN}KVM64${CL}" + echo -e "${DGN}Allocated Cores: ${BGN}${CORE_COUNT}${CL}" + echo -e "${DGN}Allocated RAM: ${BGN}${RAM_SIZE}${CL}" + echo -e "${DGN}Using Bridge: ${BGN}${BRG}${CL}" + echo -e "${DGN}Using MAC Address: ${BGN}${MAC}${CL}" + echo -e "${DGN}Using VLAN: ${BGN}Default${CL}" + echo -e "${DGN}Using Interface MTU Size: ${BGN}Default${CL}" + echo -e "${DGN}Start VM when completed: ${BGN}no${CL}" + echo -e "${BL}Creating a TurnKey ownCloud VM using the above default settings${CL}" +} + +function advanced_settings() { + while true; do + if VMID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Virtual Machine ID" 8 58 $NEXTID --title "VIRTUAL MACHINE ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z "$VMID" ]; then + VMID="$NEXTID" + fi + if pct status "$VMID" &>/dev/null || qm status "$VMID" &>/dev/null; then + echo -e "${CROSS}${RD} ID $VMID is already in use${CL}" + sleep 2 + continue + fi + echo -e "${DGN}Virtual Machine ID: ${BGN}$VMID${CL}" + break + else + exit-script + fi + done + + if MACH=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "MACHINE TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 10 58 2 \ + "i440fx" "Machine i440fx" ON \ + "q35" "Machine q35" OFF \ + 3>&1 1>&2 2>&3); then + if [ $MACH = q35 ]; then + echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" + FORMAT="" + MACHINE=" -machine q35" + else + echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" + FORMAT=",efitype=4m" + MACHINE="" + fi + else + exit-script + fi + + if DISK_CACHE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DISK CACHE" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \ + "0" "None (Default)" ON \ + "1" "Write Through" OFF \ + 3>&1 1>&2 2>&3); then + if [ $DISK_CACHE = "1" ]; then + echo -e "${DGN}Using Disk Cache: ${BGN}Write Through${CL}" + DISK_CACHE="cache=writethrough," + else + echo -e "${DGN}Using Disk Cache: ${BGN}None${CL}" + DISK_CACHE="" + fi + else + exit-script + fi + + if VM_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 turnkey-owncloud-vm --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VM_NAME ]; then + HN="turnkey-owncloud-vm" + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + else + HN=$(echo ${VM_NAME,,} | tr -d ' ') + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + fi + else + exit-script + fi + + if CPU_TYPE1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CPU MODEL" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \ + "0" "KVM64 (Default)" ON \ + "1" "Host" OFF \ + 3>&1 1>&2 2>&3); then + if [ $CPU_TYPE1 = "1" ]; then + echo -e "${DGN}Using CPU Model: ${BGN}Host${CL}" + CPU_TYPE=" -cpu host" + else + echo -e "${DGN}Using CPU Model: ${BGN}KVM64${CL}" + CPU_TYPE="" + fi + else + exit-script + fi + + if CORE_COUNT=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 2 --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $CORE_COUNT ]; then + CORE_COUNT="2" + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + else + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + fi + else + exit-script + fi + + if RAM_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 2048 --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $RAM_SIZE ]; then + RAM_SIZE="2048" + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + else + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + fi + else + exit-script + fi + + if BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $BRG ]; then + BRG="vmbr0" + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + else + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + fi + else + exit-script + fi + + if MAC1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a MAC Address" 8 58 $GEN_MAC --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MAC1 ]; then + MAC="$GEN_MAC" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC${CL}" + else + MAC="$MAC1" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + fi + else + exit-script + fi + + if VLAN1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VLAN1 ]; then + VLAN1="Default" + VLAN="" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + else + VLAN=",tag=$VLAN1" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + fi + else + exit-script + fi + + if MTU1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Interface MTU Size (leave blank for default)" 8 58 --title "MTU SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MTU1 ]; then + MTU1="Default" + MTU="" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + else + MTU=",mtu=$MTU1" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + fi + else + exit-script + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "START VIRTUAL MACHINE" --yesno "Start VM when completed?" 10 58); then + echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}" + START_VM="yes" + else + echo -e "${DGN}Start VM when completed: ${BGN}no${CL}" + START_VM="no" + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create a TurnKey ownCloud VM?" --no-button Do-Over 10 58); then + echo -e "${RD}Creating a TurnKey ownCloud VM using the above advanced settings${CL}" + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +function start_script() { + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +check_root +arch_check +pve_check +ssh_check +start_script + +msg_info "Validating Storage" +while read -r line; do + TAG=$(echo $line | awk '{print $1}') + TYPE=$(echo $line | awk '{printf "%-10s", $2}') + FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') + ITEM=" Type: $TYPE Free: $FREE " + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + STORAGE_MENU+=("$TAG" "$ITEM" "OFF") +done < <(pvesm status -content images | awk 'NR>1') +VALID=$(pvesm status -content images | awk 'NR>1') +if [ -z "$VALID" ]; then + msg_error "Unable to detect a valid storage location." + exit +elif [ $((${#STORAGE_MENU[@]} / 3)) -eq 1 ]; then + STORAGE=${STORAGE_MENU[0]} +else + while [ -z "${STORAGE:+x}" ]; do + STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \ + "Which storage pool you would like to use for ${HN}?\nTo make a selection, use the Spacebar.\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit + done +fi +msg_ok "Using ${CL}${BL}$STORAGE${CL} ${GN}for Storage Location." +msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}." +msg_info "Retrieving the URL for the TurnKey ownCloud ISO Disk Image" +URL=http://mirror.turnkeylinux.org/turnkeylinux/images/iso/turnkey-owncloud-18.0-bookworm-amd64.iso +sleep 2 +msg_ok "${CL}${BL}${URL}${CL}" +wget -q --show-progress $URL +echo -en "\e[1A\e[0K" +FILE=$(basename $URL) +msg_ok "Downloaded ${CL}${BL}${FILE}${CL}" + +STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') +case $STORAGE_TYPE in +nfs | dir) + DISK_EXT=".raw" + DISK_REF="$VMID/" + DISK_IMPORT="-format raw" + THIN="" + ;; +btrfs) + DISK_EXT=".raw" + DISK_REF="$VMID/" + DISK_IMPORT="-format raw" + FORMAT=",efitype=4m" + THIN="" + ;; +esac +for i in {0,1}; do + disk="DISK$i" + eval DISK${i}=vm-${VMID}-disk-${i}${DISK_EXT:-} + eval DISK${i}_REF=${STORAGE}:${DISK_REF:-}${!disk} +done + +msg_info "Creating a TurnKey ownCloud VM" +qm create $VMID -agent 1${MACHINE} -tablet 0 -localtime 1 -bios seabios${CPU_TYPE} -cores $CORE_COUNT -memory $RAM_SIZE \ + -name $HN -tags proxmox-helper-scripts -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci +pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null +qm importdisk $VMID ${FILE} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null +qm set $VMID \ + -efidisk0 ${DISK0_REF}${FORMAT} \ + -scsi0 ${DISK1_REF},${DISK_CACHE}${THIN}size=12G \ + -boot order=scsi0 \ + -description "
+ + # TurnKey ownCloud VM + + +
" >/dev/null +msg_ok "Created a TurnKey ownCloud VM ${CL}${BL}(${HN})" +if [ "$START_VM" == "yes" ]; then + msg_info "Starting TurnKey ownCloud VM" + qm start $VMID + msg_ok "Started TurnKey ownCloud VM" +fi +msg_ok "Completed Successfully!\n" diff --git a/vm/pimox-haos-vm.sh b/vm/pimox-haos-vm.sh new file mode 100644 index 00000000..4e1c4766 --- /dev/null +++ b/vm/pimox-haos-vm.sh @@ -0,0 +1,325 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + cat <<"EOF" + ____ _ __ ___ + / __ \(_) |/ /___ _ __ + / /_/ / / /|_/ / __ \| |/_/ + / ____/ / / / / /_/ /> < + __ __ /_/_ /_/_/ /_/\____/_/|_| __ ____ _____ + / / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_ / __ \/ ___/ + / /_/ / __ \/ __ `__ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/ / / / /\__ \ + / __ / /_/ / / / / / / __/ / ___ |(__ |__ ) (__ ) /_/ /_/ / / / / /_ / /_/ /___/ / +/_/ /_/\____/_/ /_/ /_/\___/ /_/ |_/____/____/_/____/\__/\__,_/_/ /_/\__/ \____//____/ + +EOF +} +clear +header_info +echo -e "Loading..." +GEN_MAC=$(echo '00 60 2f'$(od -An -N3 -t xC /dev/urandom) | sed -e 's/ /:/g' | tr '[:lower:]' '[:upper:]') +USEDID=$(pvesh get /cluster/resources --type vm --output-format yaml | egrep -i 'vmid' | awk '{print substr($2, 1, length($2)-0) }') +NEXTID=$(pvesh get /cluster/nextid) +STABLE=$(curl -s https://raw.githubusercontent.com/home-assistant/version/master/stable.json | grep "ova" | awk '{print substr($2, 2, length($2)-3) }') +BETA=$(curl -s https://raw.githubusercontent.com/home-assistant/version/master/beta.json | grep "ova" | awk '{print substr($2, 2, length($2)-3) }') +DEV=$(curl -s https://raw.githubusercontent.com/home-assistant/version/master/dev.json | grep "ova" | awk '{print substr($2, 2, length($2)-3) }') +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +HA=$(echo "\033[1;34m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR +trap cleanup EXIT +function error_exit() { + trap - ERR + local reason="Unknown failure occurred." + local msg="${1:-$reason}" + local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + [ ! -z ${VMID-} ] && cleanup_vmid + exit $EXIT +} +function cleanup_vmid() { + if $(qm status $VMID &>/dev/null); then + if [ "$(qm status $VMID | awk '{print $2}')" == "running" ]; then + qm stop $VMID + fi + qm destroy $VMID + fi +} +function cleanup() { + popd >/dev/null + rm -rf $TEMP_DIR +} +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +if ! command -v whiptail &> /dev/null; then + echo "Installing whiptail..." + apt-get update &>/dev/null + apt-get install -y whiptail &>/dev/null +fi +if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "PiMox HAOS VM" --yesno "This will create a New PiMox HAOS VM. Proceed?" 10 58); then + echo "User selected Yes" +else + clear + echo -e "⚠ User exited script \n" + exit +fi +function ARCH_CHECK() { + ARCH=$(dpkg --print-architecture) + if [[ "$ARCH" == "amd64" ]]; then + echo -e "\n ❌ This script only works with PiMox! \n" + echo -e "Exiting..." + sleep 2 + exit + fi +} +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +function default_settings() { + echo -e "${DGN}Using HAOS Version: ${BGN}${STABLE}${CL}" + BRANCH=${STABLE} + echo -e "${DGN}Using Virtual Machine ID: ${BGN}$NEXTID${CL}" + VMID=$NEXTID + echo -e "${DGN}Using Hostname: ${BGN}haos${STABLE}${CL}" + HN=haos${STABLE} + echo -e "${DGN}Allocated Cores: ${BGN}2${CL}" + CORE_COUNT="2" + echo -e "${DGN}Allocated RAM: ${BGN}4096${CL}" + RAM_SIZE="4096" + echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}" + BRG="vmbr0" + echo -e "${DGN}Using MAC Address: ${BGN}$GEN_MAC${CL}" + MAC=$GEN_MAC + echo -e "${DGN}Using VLAN: ${BGN}Default${CL}" + VLAN="" + echo -e "${DGN}Using Interface MTU Size: ${BGN}Default${CL}" + MTU="" + echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}" + START_VM="yes" + echo -e "${BL}Creating a HAOS VM using the above default settings${CL}" +} +function advanced_settings() { + BRANCH=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "HAOS VERSION" --radiolist "Choose Version" --cancel-button Exit-Script 10 58 3 \ + "$STABLE" "Stable" ON \ + "$BETA" "Beta" OFF \ + "$DEV" "Dev" OFF \ + 3>&1 1>&2 2>&3) + exitstatus=$? + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using HAOS Version: ${BGN}$BRANCH${CL}"; fi + VMID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Virtual Machine ID" 8 58 $NEXTID --title "VIRTUAL MACHINE ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3) + exitstatus=$? + if [ -z $VMID ]; then + VMID="$NEXTID" + echo -e "${DGN}Virtual Machine: ${BGN}$VMID${CL}" + else + if echo "$USEDID" | egrep -q "$VMID"; then + echo -e "\n🚨 ${RD}ID $VMID is already in use${CL} \n" + echo -e "Exiting Script \n" + sleep 2 + exit + else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Virtual Machine ID: ${BGN}$VMID${CL}"; fi + fi + fi + VM_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 haos${BRANCH} --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) + exitstatus=$? + if [ -z $VM_NAME ]; then + HN="haos${BRANCH}" + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + else + if [ $exitstatus = 0 ]; then + HN=$(echo ${VM_NAME,,} | tr -d ' ') + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + fi + fi + CORE_COUNT=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 2 --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3) + exitstatus=$? + if [ -z $CORE_COUNT ]; then + CORE_COUNT="2" + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi + fi + RAM_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 4096 --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) + exitstatus=$? + if [ -z $RAM_SIZE ]; then + RAM_SIZE="4096" + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi + fi + BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3) + exitstatus=$? + if [ -z $BRG ]; then + BRG="vmbr0" + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi + fi + MAC1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a MAC Address" 8 58 $GEN_MAC --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3) + exitstatus=$? + if [ -z $MAC1 ]; then + MAC="$GEN_MAC" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC${CL}" + else + if [ $exitstatus = 0 ]; then + MAC="$MAC1" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + fi + fi + VLAN1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3) + exitstatus=$? + if [ $exitstatus = 0 ]; then + if [ -z $VLAN1 ]; then + VLAN1="Default" VLAN="" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + else + VLAN=",tag=$VLAN1" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + fi + fi + MTU1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Interface MTU Size (leave blank for default)" 8 58 --title "MTU SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3) + exitstatus=$? + if [ $exitstatus = 0 ]; then + if [ -z $MTU1 ]; then + MTU1="Default" MTU="" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + else + MTU=",mtu=$MTU1" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + fi + fi + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "START VIRTUAL MACHINE" --yesno "Start VM when completed?" 10 58); then + echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}" + START_VM="yes" + else + echo -e "${DGN}Start VM when completed: ${BGN}no${CL}" + START_VM="no" + fi + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create HAOS ${BRANCH} VM?" --no-button Do-Over 10 58); then + echo -e "${RD}Creating a HAOS VM using the above advanced settings${CL}" + else + clear + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} +function START_SCRIPT() { + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then + clear + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings + else + clear + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} +ARCH_CHECK +START_SCRIPT +while read -r line; do + TAG=$(echo $line | awk '{print $1}') + TYPE=$(echo $line | awk '{printf "%-10s", $2}') + FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') + ITEM=" Type: $TYPE Free: $FREE " + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + STORAGE_MENU+=("$TAG" "$ITEM" "OFF") +done < <(pvesm status -content images | awk 'NR>1') +if [ $((${#STORAGE_MENU[@]} / 3)) -eq 0 ]; then + echo -e "'Disk image' needs to be selected for at least one storage location." + die "Unable to detect valid storage location." +elif [ $((${#STORAGE_MENU[@]} / 3)) -eq 1 ]; then + STORAGE=${STORAGE_MENU[0]} +else + while [ -z "${STORAGE:+x}" ]; do + STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \ + "Which storage pool you would like to use for the HAOS VM?\n\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit + done +fi +msg_ok "Using ${CL}${BL}$STORAGE${CL} ${GN}for Storage Location." +msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}." +msg_info "Getting URL for Home Assistant ${BRANCH} Disk Image" +URL=https://github.com/home-assistant/operating-system/releases/download/${BRANCH}/haos_generic-aarch64-${BRANCH}.qcow2.xz +sleep 2 +msg_ok "${CL}${BL}${URL}${CL}" +wget -q --show-progress $URL +echo -en "\e[1A\e[0K" +FILE=$(basename $URL) +msg_ok "Downloaded ${CL}${BL}haos_generic-aarch64-${BRANCH}.qcow2.xz${CL}" +msg_info "Extracting Disk Image" +unxz $FILE +STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') +case $STORAGE_TYPE in +nfs | dir) + DISK_EXT=".qcow2" + DISK_REF="$VMID/" + DISK_IMPORT="-format qcow2" + ;; +esac +for i in {0,1}; do + disk="DISK$i" + eval DISK${i}=vm-${VMID}-disk-${i}${DISK_EXT:-} + eval DISK${i}_REF=${STORAGE}:${DISK_REF:-}${!disk} +done +msg_ok "Extracted Disk Image" +msg_info "Creating HAOS VM" +qm create $VMID -bios ovmf -cores $CORE_COUNT -memory $RAM_SIZE -name $HN \ + -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci +pvesm alloc $STORAGE $VMID $DISK0 64M 1>&/dev/null +qm importdisk $VMID ${FILE%.*} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null +qm set $VMID \ + -efidisk0 ${DISK0_REF},efitype=4m,size=64M \ + -scsi0 ${DISK1_REF},size=32G >/dev/null +qm set $VMID \ + -boot order=scsi0 \ + -description "
+ + # Home Assistant OS + + +
" >/dev/null +msg_ok "Created HAOS VM ${CL}${BL}(${HN})" +if [ "$START_VM" == "yes" ]; then + msg_info "Starting Home Assistant OS VM" + qm start $VMID + msg_ok "Started Home Assistant OS VM" +fi +msg_ok "Completed Successfully!\n" diff --git a/vm/ubuntu2204-vm.sh b/vm/ubuntu2204-vm.sh new file mode 100644 index 00000000..cb6884d8 --- /dev/null +++ b/vm/ubuntu2204-vm.sh @@ -0,0 +1,428 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + __ ____ __ ___ ___ ____ __ __ _ ____ ___ + / / / / /_ __ ______ / /___ __ |__ \|__ \ / __ \/ // / | | / / |/ / + / / / / __ \/ / / / __ \/ __/ / / / __/ /__/ / / / / / // /_ | | / / /|_/ / +/ /_/ / /_/ / /_/ / / / / /_/ /_/ / / __// __/_/ /_/ /__ __/ | |/ / / / / +\____/_.___/\__,_/_/ /_/\__/\__,_/ /____/____(_)____/ /_/ |___/_/ /_/ + +EOF +} +header_info +echo -e "\n Loading..." +GEN_MAC=02:$(openssl rand -hex 5 | awk '{print toupper($0)}' | sed 's/\(..\)/\1:/g; s/.$//') +NEXTID=$(pvesh get /cluster/nextid) + +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +HA=$(echo "\033[1;34m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" +THIN="discard=on,ssd=1," +set -e +trap 'error_handler $LINENO "$BASH_COMMAND"' ERR +trap cleanup EXIT +function error_handler() { + local exit_code="$?" + local line_number="$1" + local command="$2" + local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" + echo -e "\n$error_message\n" + cleanup_vmid +} + +function cleanup_vmid() { + if qm status $VMID &>/dev/null; then + qm stop $VMID &>/dev/null + qm destroy $VMID &>/dev/null + fi +} + +function cleanup() { + popd >/dev/null + rm -rf $TEMP_DIR +} + +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +if whiptail --backtitle "Proxmox VE Helper Scripts" --title "Ubuntu 22.04 VM" --yesno "This will create a New Ubuntu 22.04 VM. Proceed?" 10 58; then + : +else + header_info && echo -e "⚠ User exited script \n" && exit +fi + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +function check_root() { + if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then + clear + msg_error "Please run this script as root." + echo -e "\nExiting..." + sleep 2 + exit + fi +} + +function pve_check() { + if ! pveversion | grep -Eq "pve-manager/8.[1-3]"; then + msg_error "This version of Proxmox Virtual Environment is not supported" + echo -e "Requires Proxmox Virtual Environment Version 8.1 or later." + echo -e "Exiting..." + sleep 2 + exit +fi +} + +function arch_check() { + if [ "$(dpkg --print-architecture)" != "amd64" ]; then + msg_error "This script will not work with PiMox! \n" + echo -e "Exiting..." + sleep 2 + exit + fi +} + +function ssh_check() { + if command -v pveversion >/dev/null 2>&1; then + if [ -n "${SSH_CLIENT:+x}" ]; then + if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "SSH DETECTED" --yesno "It's suggested to use the Proxmox shell instead of SSH, since SSH can create issues while gathering variables. Would you like to proceed with using SSH?" 10 62; then + echo "you've been warned" + else + clear + exit + fi + fi + fi +} + +function exit-script() { + clear + echo -e "⚠ User exited script \n" + exit +} + +function default_settings() { + VMID="$NEXTID" + FORMAT=",efitype=4m" + MACHINE="" + DISK_CACHE="" + HN="ubuntu" + CPU_TYPE="" + CORE_COUNT="2" + RAM_SIZE="2048" + BRG="vmbr0" + MAC="$GEN_MAC" + VLAN="" + MTU="" + START_VM="no" + echo -e "${DGN}Using Virtual Machine ID: ${BGN}${VMID}${CL}" + echo -e "${DGN}Using Machine Type: ${BGN}i440fx${CL}" + echo -e "${DGN}Using Disk Cache: ${BGN}None${CL}" + echo -e "${DGN}Using Hostname: ${BGN}${HN}${CL}" + echo -e "${DGN}Using CPU Model: ${BGN}KVM64${CL}" + echo -e "${DGN}Allocated Cores: ${BGN}${CORE_COUNT}${CL}" + echo -e "${DGN}Allocated RAM: ${BGN}${RAM_SIZE}${CL}" + echo -e "${DGN}Using Bridge: ${BGN}${BRG}${CL}" + echo -e "${DGN}Using MAC Address: ${BGN}${MAC}${CL}" + echo -e "${DGN}Using VLAN: ${BGN}Default${CL}" + echo -e "${DGN}Using Interface MTU Size: ${BGN}Default${CL}" + echo -e "${DGN}Start VM when completed: ${BGN}no${CL}" + echo -e "${BL}Creating an Ubuntu 22.04 VM using the above default settings${CL}" +} + +function advanced_settings() { + while true; do + if VMID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Virtual Machine ID" 8 58 $NEXTID --title "VIRTUAL MACHINE ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z "$VMID" ]; then + VMID="$NEXTID" + fi + if pct status "$VMID" &>/dev/null || qm status "$VMID" &>/dev/null; then + echo -e "${CROSS}${RD} ID $VMID is already in use${CL}" + sleep 2 + continue + fi + echo -e "${DGN}Virtual Machine ID: ${BGN}$VMID${CL}" + break + else + exit-script + fi + done + + if MACH=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "MACHINE TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 10 58 2 \ + "i440fx" "Machine i440fx" ON \ + "q35" "Machine q35" OFF \ + 3>&1 1>&2 2>&3); then + if [ $MACH = q35 ]; then + echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" + FORMAT="" + MACHINE=" -machine q35" + else + echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" + FORMAT=",efitype=4m" + MACHINE="" + fi + else + exit-script + fi + + if DISK_CACHE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DISK CACHE" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \ + "0" "None (Default)" ON \ + "1" "Write Through" OFF \ + 3>&1 1>&2 2>&3); then + if [ $DISK_CACHE = "1" ]; then + echo -e "${DGN}Using Disk Cache: ${BGN}Write Through${CL}" + DISK_CACHE="cache=writethrough," + else + echo -e "${DGN}Using Disk Cache: ${BGN}None${CL}" + DISK_CACHE="" + fi + else + exit-script + fi + + if VM_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 ubuntu --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VM_NAME ]; then + HN="ubuntu" + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + else + HN=$(echo ${VM_NAME,,} | tr -d ' ') + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + fi + else + exit-script + fi + + if CPU_TYPE1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CPU MODEL" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \ + "0" "KVM64 (Default)" ON \ + "1" "Host" OFF \ + 3>&1 1>&2 2>&3); then + if [ $CPU_TYPE1 = "1" ]; then + echo -e "${DGN}Using CPU Model: ${BGN}Host${CL}" + CPU_TYPE=" -cpu host" + else + echo -e "${DGN}Using CPU Model: ${BGN}KVM64${CL}" + CPU_TYPE="" + fi + else + exit-script + fi + + if CORE_COUNT=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 2 --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $CORE_COUNT ]; then + CORE_COUNT="2" + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + else + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + fi + else + exit-script + fi + + if RAM_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 2048 --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $RAM_SIZE ]; then + RAM_SIZE="2048" + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + else + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + fi + else + exit-script + fi + + if BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $BRG ]; then + BRG="vmbr0" + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + else + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + fi + else + exit-script + fi + + if MAC1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a MAC Address" 8 58 $GEN_MAC --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MAC1 ]; then + MAC="$GEN_MAC" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC${CL}" + else + MAC="$MAC1" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + fi + else + exit-script + fi + + if VLAN1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VLAN1 ]; then + VLAN1="Default" + VLAN="" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + else + VLAN=",tag=$VLAN1" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + fi + else + exit-script + fi + + if MTU1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Interface MTU Size (leave blank for default)" 8 58 --title "MTU SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MTU1 ]; then + MTU1="Default" + MTU="" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + else + MTU=",mtu=$MTU1" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + fi + else + exit-script + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "START VIRTUAL MACHINE" --yesno "Start VM when completed?" 10 58); then + echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}" + START_VM="yes" + else + echo -e "${DGN}Start VM when completed: ${BGN}no${CL}" + START_VM="no" + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create an Ubuntu 22.04 VM?" --no-button Do-Over 10 58); then + echo -e "${RD}Creating an Ubuntu 22.04 VM using the above advanced settings${CL}" + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +function start_script() { + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +check_root +arch_check +pve_check +ssh_check +start_script + +msg_info "Validating Storage" +while read -r line; do + TAG=$(echo $line | awk '{print $1}') + TYPE=$(echo $line | awk '{printf "%-10s", $2}') + FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') + ITEM=" Type: $TYPE Free: $FREE " + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + STORAGE_MENU+=("$TAG" "$ITEM" "OFF") +done < <(pvesm status -content images | awk 'NR>1') +VALID=$(pvesm status -content images | awk 'NR>1') +if [ -z "$VALID" ]; then + msg_error "Unable to detect a valid storage location." + exit +elif [ $((${#STORAGE_MENU[@]} / 3)) -eq 1 ]; then + STORAGE=${STORAGE_MENU[0]} +else + while [ -z "${STORAGE:+x}" ]; do + STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \ + "Which storage pool you would like to use for ${HN}?\nTo make a selection, use the Spacebar.\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit + done +fi +msg_ok "Using ${CL}${BL}$STORAGE${CL} ${GN}for Storage Location." +msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}." +msg_info "Retrieving the URL for the Ubuntu 22.04 Disk Image" +URL=https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img +sleep 2 +msg_ok "${CL}${BL}${URL}${CL}" +wget -q --show-progress $URL +echo -en "\e[1A\e[0K" +FILE=$(basename $URL) +msg_ok "Downloaded ${CL}${BL}${FILE}${CL}" + +STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') +case $STORAGE_TYPE in +nfs | dir) + DISK_EXT=".qcow2" + DISK_REF="$VMID/" + DISK_IMPORT="-format qcow2" + THIN="" + ;; +btrfs) + DISK_EXT=".raw" + DISK_REF="$VMID/" + DISK_IMPORT="-format raw" + FORMAT=",efitype=4m" + THIN="" + ;; +esac +for i in {0,1}; do + disk="DISK$i" + eval DISK${i}=vm-${VMID}-disk-${i}${DISK_EXT:-} + eval DISK${i}_REF=${STORAGE}:${DISK_REF:-}${!disk} +done + +msg_info "Creating a Ubuntu 22.04 VM" +qm create $VMID -agent 1${MACHINE} -tablet 0 -localtime 1 -bios ovmf${CPU_TYPE} -cores $CORE_COUNT -memory $RAM_SIZE \ + -name $HN -tags proxmox-helper-scripts -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci +pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null +qm importdisk $VMID ${FILE} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null +qm set $VMID \ + -efidisk0 ${DISK0_REF}${FORMAT} \ + -scsi0 ${DISK1_REF},${DISK_CACHE}${THIN}size=2G \ + -ide2 ${STORAGE}:cloudinit \ + -boot order=scsi0 \ + -serial0 socket \ + -description "
+ + # Ubuntu 22.04 VM + + +
" >/dev/null +msg_ok "Created a Ubuntu 22.04 VM ${CL}${BL}(${HN})" +if [ "$START_VM" == "yes" ]; then + msg_info "Starting Ubuntu 22.04 VM" + qm start $VMID + msg_ok "Started Ubuntu 22.04 VM" +fi +msg_ok "Completed Successfully!\n" +echo -e "Setup Cloud-Init before starting \n +More info at https://github.com/tteck/Proxmox/discussions/2072 \n" diff --git a/vm/ubuntu2404-vm.sh b/vm/ubuntu2404-vm.sh new file mode 100644 index 00000000..c3dd1750 --- /dev/null +++ b/vm/ubuntu2404-vm.sh @@ -0,0 +1,428 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { + clear + cat <<"EOF" + __ ____ __ ___ __ __ ____ __ __ _ ____ ___ + / / / / /_ __ ______ / /___ __ |__ \/ // / / __ \/ // / | | / / |/ / + / / / / __ \/ / / / __ \/ __/ / / / __/ / // /_ / / / / // /_ | | / / /|_/ / +/ /_/ / /_/ / /_/ / / / / /_/ /_/ / / __/__ __// /_/ /__ __/ | |/ / / / / +\____/_.___/\__,_/_/ /_/\__/\__,_/ /____/ /_/ (_)____/ /_/ |___/_/ /_/ + +EOF +} +header_info +echo -e "\n Loading..." +GEN_MAC=02:$(openssl rand -hex 5 | awk '{print toupper($0)}' | sed 's/\(..\)/\1:/g; s/.$//') +NEXTID=$(pvesh get /cluster/nextid) + +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +HA=$(echo "\033[1;34m") +RD=$(echo "\033[01;31m") +BGN=$(echo "\033[4;92m") +GN=$(echo "\033[1;92m") +DGN=$(echo "\033[32m") +CL=$(echo "\033[m") +BFR="\\r\\033[K" +HOLD="-" +CM="${GN}✓${CL}" +CROSS="${RD}✗${CL}" +THIN="discard=on,ssd=1," +set -e +trap 'error_handler $LINENO "$BASH_COMMAND"' ERR +trap cleanup EXIT +function error_handler() { + local exit_code="$?" + local line_number="$1" + local command="$2" + local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}" + echo -e "\n$error_message\n" + cleanup_vmid +} + +function cleanup_vmid() { + if qm status $VMID &>/dev/null; then + qm stop $VMID &>/dev/null + qm destroy $VMID &>/dev/null + fi +} + +function cleanup() { + popd >/dev/null + rm -rf $TEMP_DIR +} + +TEMP_DIR=$(mktemp -d) +pushd $TEMP_DIR >/dev/null +if whiptail --backtitle "Proxmox VE Helper Scripts" --title "Ubuntu 24.04 VM" --yesno "This will create a New Ubuntu 24.04 VM. Proceed?" 10 58; then + : +else + header_info && echo -e "⚠ User exited script \n" && exit +fi + +function msg_info() { + local msg="$1" + echo -ne " ${HOLD} ${YW}${msg}..." +} + +function msg_ok() { + local msg="$1" + echo -e "${BFR} ${CM} ${GN}${msg}${CL}" +} + +function msg_error() { + local msg="$1" + echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}" +} + +function check_root() { + if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then + clear + msg_error "Please run this script as root." + echo -e "\nExiting..." + sleep 2 + exit + fi +} + +function pve_check() { + if ! pveversion | grep -Eq "pve-manager/8.[1-3]"; then + msg_error "This version of Proxmox Virtual Environment is not supported" + echo -e "Requires Proxmox Virtual Environment Version 8.1 or later." + echo -e "Exiting..." + sleep 2 + exit +fi +} + +function arch_check() { + if [ "$(dpkg --print-architecture)" != "amd64" ]; then + msg_error "This script will not work with PiMox! \n" + echo -e "Exiting..." + sleep 2 + exit + fi +} + +function ssh_check() { + if command -v pveversion >/dev/null 2>&1; then + if [ -n "${SSH_CLIENT:+x}" ]; then + if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "SSH DETECTED" --yesno "It's suggested to use the Proxmox shell instead of SSH, since SSH can create issues while gathering variables. Would you like to proceed with using SSH?" 10 62; then + echo "you've been warned" + else + clear + exit + fi + fi + fi +} + +function exit-script() { + clear + echo -e "⚠ User exited script \n" + exit +} + +function default_settings() { + VMID="$NEXTID" + FORMAT=",efitype=4m" + MACHINE="" + DISK_CACHE="" + HN="ubuntu" + CPU_TYPE="" + CORE_COUNT="2" + RAM_SIZE="2048" + BRG="vmbr0" + MAC="$GEN_MAC" + VLAN="" + MTU="" + START_VM="no" + echo -e "${DGN}Using Virtual Machine ID: ${BGN}${VMID}${CL}" + echo -e "${DGN}Using Machine Type: ${BGN}i440fx${CL}" + echo -e "${DGN}Using Disk Cache: ${BGN}None${CL}" + echo -e "${DGN}Using Hostname: ${BGN}${HN}${CL}" + echo -e "${DGN}Using CPU Model: ${BGN}KVM64${CL}" + echo -e "${DGN}Allocated Cores: ${BGN}${CORE_COUNT}${CL}" + echo -e "${DGN}Allocated RAM: ${BGN}${RAM_SIZE}${CL}" + echo -e "${DGN}Using Bridge: ${BGN}${BRG}${CL}" + echo -e "${DGN}Using MAC Address: ${BGN}${MAC}${CL}" + echo -e "${DGN}Using VLAN: ${BGN}Default${CL}" + echo -e "${DGN}Using Interface MTU Size: ${BGN}Default${CL}" + echo -e "${DGN}Start VM when completed: ${BGN}no${CL}" + echo -e "${BL}Creating an Ubuntu 24.04 VM using the above default settings${CL}" +} + +function advanced_settings() { + while true; do + if VMID=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Virtual Machine ID" 8 58 $NEXTID --title "VIRTUAL MACHINE ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z "$VMID" ]; then + VMID="$NEXTID" + fi + if pct status "$VMID" &>/dev/null || qm status "$VMID" &>/dev/null; then + echo -e "${CROSS}${RD} ID $VMID is already in use${CL}" + sleep 2 + continue + fi + echo -e "${DGN}Virtual Machine ID: ${BGN}$VMID${CL}" + break + else + exit-script + fi + done + + if MACH=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "MACHINE TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 10 58 2 \ + "i440fx" "Machine i440fx" ON \ + "q35" "Machine q35" OFF \ + 3>&1 1>&2 2>&3); then + if [ $MACH = q35 ]; then + echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" + FORMAT="" + MACHINE=" -machine q35" + else + echo -e "${DGN}Using Machine Type: ${BGN}$MACH${CL}" + FORMAT=",efitype=4m" + MACHINE="" + fi + else + exit-script + fi + + if DISK_CACHE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DISK CACHE" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \ + "0" "None (Default)" ON \ + "1" "Write Through" OFF \ + 3>&1 1>&2 2>&3); then + if [ $DISK_CACHE = "1" ]; then + echo -e "${DGN}Using Disk Cache: ${BGN}Write Through${CL}" + DISK_CACHE="cache=writethrough," + else + echo -e "${DGN}Using Disk Cache: ${BGN}None${CL}" + DISK_CACHE="" + fi + else + exit-script + fi + + if VM_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 ubuntu --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VM_NAME ]; then + HN="ubuntu" + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + else + HN=$(echo ${VM_NAME,,} | tr -d ' ') + echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" + fi + else + exit-script + fi + + if CPU_TYPE1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CPU MODEL" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \ + "0" "KVM64 (Default)" ON \ + "1" "Host" OFF \ + 3>&1 1>&2 2>&3); then + if [ $CPU_TYPE1 = "1" ]; then + echo -e "${DGN}Using CPU Model: ${BGN}Host${CL}" + CPU_TYPE=" -cpu host" + else + echo -e "${DGN}Using CPU Model: ${BGN}KVM64${CL}" + CPU_TYPE="" + fi + else + exit-script + fi + + if CORE_COUNT=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 2 --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $CORE_COUNT ]; then + CORE_COUNT="2" + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + else + echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" + fi + else + exit-script + fi + + if RAM_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 2048 --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $RAM_SIZE ]; then + RAM_SIZE="2048" + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + else + echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" + fi + else + exit-script + fi + + if BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $BRG ]; then + BRG="vmbr0" + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + else + echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" + fi + else + exit-script + fi + + if MAC1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a MAC Address" 8 58 $GEN_MAC --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MAC1 ]; then + MAC="$GEN_MAC" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC${CL}" + else + MAC="$MAC1" + echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" + fi + else + exit-script + fi + + if VLAN1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $VLAN1 ]; then + VLAN1="Default" + VLAN="" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + else + VLAN=",tag=$VLAN1" + echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" + fi + else + exit-script + fi + + if MTU1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Interface MTU Size (leave blank for default)" 8 58 --title "MTU SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if [ -z $MTU1 ]; then + MTU1="Default" + MTU="" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + else + MTU=",mtu=$MTU1" + echo -e "${DGN}Using Interface MTU Size: ${BGN}$MTU1${CL}" + fi + else + exit-script + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "START VIRTUAL MACHINE" --yesno "Start VM when completed?" 10 58); then + echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}" + START_VM="yes" + else + echo -e "${DGN}Start VM when completed: ${BGN}no${CL}" + START_VM="no" + fi + + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create an Ubuntu 24.04 VM?" --no-button Do-Over 10 58); then + echo -e "${RD}Creating an Ubuntu 24.04 VM using the above advanced settings${CL}" + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +function start_script() { + if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then + header_info + echo -e "${BL}Using Default Settings${CL}" + default_settings + else + header_info + echo -e "${RD}Using Advanced Settings${CL}" + advanced_settings + fi +} + +check_root +arch_check +pve_check +ssh_check +start_script + +msg_info "Validating Storage" +while read -r line; do + TAG=$(echo $line | awk '{print $1}') + TYPE=$(echo $line | awk '{printf "%-10s", $2}') + FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '{printf( "%9sB", $6)}') + ITEM=" Type: $TYPE Free: $FREE " + OFFSET=2 + if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then + MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET)) + fi + STORAGE_MENU+=("$TAG" "$ITEM" "OFF") +done < <(pvesm status -content images | awk 'NR>1') +VALID=$(pvesm status -content images | awk 'NR>1') +if [ -z "$VALID" ]; then + msg_error "Unable to detect a valid storage location." + exit +elif [ $((${#STORAGE_MENU[@]} / 3)) -eq 1 ]; then + STORAGE=${STORAGE_MENU[0]} +else + while [ -z "${STORAGE:+x}" ]; do + STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \ + "Which storage pool you would like to use for ${HN}?\nTo make a selection, use the Spacebar.\n" \ + 16 $(($MSG_MAX_LENGTH + 23)) 6 \ + "${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit + done +fi +msg_ok "Using ${CL}${BL}$STORAGE${CL} ${GN}for Storage Location." +msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}." +msg_info "Retrieving the URL for the Ubuntu 24.04 Disk Image" +URL=https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img +sleep 2 +msg_ok "${CL}${BL}${URL}${CL}" +wget -q --show-progress $URL +echo -en "\e[1A\e[0K" +FILE=$(basename $URL) +msg_ok "Downloaded ${CL}${BL}${FILE}${CL}" + +STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') +case $STORAGE_TYPE in +nfs | dir) + DISK_EXT=".qcow2" + DISK_REF="$VMID/" + DISK_IMPORT="-format qcow2" + THIN="" + ;; +btrfs) + DISK_EXT=".raw" + DISK_REF="$VMID/" + DISK_IMPORT="-format raw" + FORMAT=",efitype=4m" + THIN="" + ;; +esac +for i in {0,1}; do + disk="DISK$i" + eval DISK${i}=vm-${VMID}-disk-${i}${DISK_EXT:-} + eval DISK${i}_REF=${STORAGE}:${DISK_REF:-}${!disk} +done + +msg_info "Creating a Ubuntu 24.04 VM" +qm create $VMID -agent 1${MACHINE} -tablet 0 -localtime 1 -bios ovmf${CPU_TYPE} -cores $CORE_COUNT -memory $RAM_SIZE \ + -name $HN -tags proxmox-helper-scripts -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci +pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null +qm importdisk $VMID ${FILE} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null +qm set $VMID \ + -efidisk0 ${DISK0_REF}${FORMAT} \ + -scsi0 ${DISK1_REF},${DISK_CACHE}${THIN}size=2G \ + -ide2 ${STORAGE}:cloudinit \ + -boot order=scsi0 \ + -serial0 socket \ + -description "
+ + # Ubuntu 24.04 VM + + +
" >/dev/null +msg_ok "Created a Ubuntu 24.04 VM ${CL}${BL}(${HN})" +if [ "$START_VM" == "yes" ]; then + msg_info "Starting Ubuntu 24.04 VM" + qm start $VMID + msg_ok "Started Ubuntu 24.04 VM" +fi +msg_ok "Completed Successfully!\n" +echo -e "Setup Cloud-Init before starting \n +More info at https://github.com/tteck/Proxmox/discussions/2072 \n"