[PR #1319] [CLOSED] Move core dependencies to a function that templates can call #2947

Open
opened 2025-11-20 05:32:40 -05:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE/pull/1319
Author: @cricalix
Created: 1/7/2025
Status: Closed

Base: mainHead: move-core-dependencies


📝 Commits (4)

  • 1789b71 Make core dependencies a function, update sample installers to use it
  • 67ddcd6 Update to title case to match other info/ok strings
  • d242578 Fix duplication in comment, rename to install_core_packages
  • 85eb661 Remove $STD, add quiet/yes, add squelch via dev/null

📊 Changes

10 files changed (+25 additions, -51 deletions)

View changed files

📝 install/alpine-docker-install.sh (+1 -5)
📝 install/alpine-grafana-install.sh (+1 -8)
📝 install/alpine-install.sh (+1 -8)
📝 install/alpine-nextcloud-install.sh (+1 -5)
📝 install/alpine-vaultwarden-install.sh (+1 -5)
📝 install/alpine-zigbee2mqtt-install.sh (+1 -8)
📝 install/debian-install.sh (+1 -6)
📝 install/ubuntu-install.sh (+1 -6)
📝 misc/alpine-install.func (+8 -0)
📝 misc/install.func (+9 -0)

📄 Description

✍️ Description

Every single install script installs a consistent set of additional packages, and every author of the scripts has to copy/paste the relevant apt or apk lines into their script. For example, across all three base distros (Alpine, Debian, Ubuntu), sudo, mc, and curl are installed, and on every Alpine image, openssh, newt, and nano are also installed.

I think it makes sense to consolidate these manual installations into a single function for several reasons:

  1. Adding a new default/core package becomes a case of updating a maximum of two files (for instance, making gnupg a default/core package)
  2. Reduction in boilerplate across all scripts - complete removal in some cases, replaced by a single line

In this PR, I'm adding a new function - install_core_packages - to both install.func and install-alpine.func, and replacing the manual dependency installation across a handful of scripts with the function for testing purposes.

If this PR is acceptable, I'll do the work to update the other 200+ installation scripts.


🛠️ Type of Change

Please check the relevant options:

  • Bug fix (non-breaking change that resolves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change unexpectedly)
  • New script (a fully functional and thoroughly tested script or set of scripts)

Prerequisites

The following steps must be completed for the pull request to be considered:

  • Self-review performed (I have reviewed my code to ensure it follows established patterns and conventions.)
  • Testing performed (I have thoroughly tested my changes and verified expected functionality.)
  • Documentation updated (I have updated any relevant documentation)

📋 Additional Information (optional)

I ran a locally modified checkout that replaced the URLs with pointers to my repository in ct/alpine.sh, misc/build.func, and ran the Alpine installer script.

    ___    __      _          
   /   |  / /___  (_)___  ___ 
  / /| | / / __ \/ / __ \/ _ \
 / ___ |/ / /_/ / / / / /  __/
/_/  |_/_/ .___/_/_/ /_/\___/ 
        /_/                   
  ⚙️  Using Default Settings on node pve
  🖥️  Operating System: alpine
  🌟  Version: 3.20
  📦  Container Type: Unprivileged
  💾  Disk Size: 0.1GB
  🧠  CPU Cores: 1
  🛠️  RAM Size: 512MiB
  🆔  Container ID: 112
  🚀  Creating a Alpine LXC using the above default settings
  
  ✔️  Using local for Template Storage.
  ✔️  Using local-lvm for Container Storage.
  ✔️  Updated LXC Template List
  ✔️  LXC Container 112 was successfully created.
  ✔️  Started LXC Container
  ✔️  Set up Container OS
  ✔️  Network Connected: 192.168.0.129
  ✔️  Internet Connected
  ✔️  DNS Resolved github.com to 4.208.26.197
  ✔️  Updated Container OS
  ✔️  Installed Core Packages
  ✔️  Customized Container
  ✔️  Completed Successfully!
alpine:~# apk list | grep -E '^(sudo|mc|newt|nano|curl|openssh)-[0-9]'
curl-8.11.1-r0 x86_64 {curl} (curl) [installed]
mc-4.8.32-r0 x86_64 {mc} (GPL-3.0-or-later) [installed]
nano-8.2-r0 x86_64 {nano} (GPL-3.0-or-later) [installed]
newt-0.52.24-r1 x86_64 {newt} (LGPL-2.0-only) [installed]
openssh-9.9_p1-r2 x86_64 {openssh} (SSH-OpenSSH) [installed]
sudo-1.9.16_p2-r0 x86_64 {sudo} (custom ISC) [installed]

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/community-scripts/ProxmoxVE/pull/1319 **Author:** [@cricalix](https://github.com/cricalix) **Created:** 1/7/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `move-core-dependencies` --- ### 📝 Commits (4) - [`1789b71`](https://github.com/community-scripts/ProxmoxVE/commit/1789b71734d0e71cc7f40b542e1c410acb00d61c) Make core dependencies a function, update sample installers to use it - [`67ddcd6`](https://github.com/community-scripts/ProxmoxVE/commit/67ddcd6ebbb7f2bfe68ed587501bb76775fb60c2) Update to title case to match other info/ok strings - [`d242578`](https://github.com/community-scripts/ProxmoxVE/commit/d242578c3526a93d0b7b5d28a1a3bbb947ff4fe6) Fix duplication in comment, rename to install_core_packages - [`85eb661`](https://github.com/community-scripts/ProxmoxVE/commit/85eb661c08c33a4a859c7ef3175ab32acb94c134) Remove $STD, add quiet/yes, add squelch via dev/null ### 📊 Changes **10 files changed** (+25 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `install/alpine-docker-install.sh` (+1 -5) 📝 `install/alpine-grafana-install.sh` (+1 -8) 📝 `install/alpine-install.sh` (+1 -8) 📝 `install/alpine-nextcloud-install.sh` (+1 -5) 📝 `install/alpine-vaultwarden-install.sh` (+1 -5) 📝 `install/alpine-zigbee2mqtt-install.sh` (+1 -8) 📝 `install/debian-install.sh` (+1 -6) 📝 `install/ubuntu-install.sh` (+1 -6) 📝 `misc/alpine-install.func` (+8 -0) 📝 `misc/install.func` (+9 -0) </details> ### 📄 Description ## ✍️ Description Every single install script installs a consistent set of additional packages, and every author of the scripts has to copy/paste the relevant `apt` or `apk` lines into their script. For example, across all three base distros (Alpine, Debian, Ubuntu), `sudo`, `mc`, and `curl` are installed, and on every Alpine image, `openssh`, `newt`, and `nano` are also installed. I think it makes sense to consolidate these manual installations into a single function for several reasons: 1. Adding a new default/core package becomes a case of updating a maximum of two files (for instance, making gnupg a default/core package) 2. Reduction in boilerplate across all scripts - complete removal in some cases, replaced by a single line In this PR, I'm adding a new function - `install_core_packages` - to both `install.func` and `install-alpine.func`, and replacing the manual dependency installation across a handful of scripts with the function for testing purposes. If this PR is acceptable, I'll do the work to update the other 200+ installation scripts. --- ## 🛠️ Type of Change Please check the relevant options: - [ ] Bug fix (non-breaking change that resolves an issue) - [X] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change unexpectedly) - [ ] New script (a fully functional and thoroughly tested script or set of scripts) --- ## ✅ Prerequisites The following steps must be completed for the pull request to be considered: - [X] Self-review performed (I have reviewed my code to ensure it follows established patterns and conventions.) - [X] Testing performed (I have thoroughly tested my changes and verified expected functionality.) - [ ] ~Documentation updated (I have updated any relevant documentation)~ --- ## 📋 Additional Information (optional) I ran a locally modified checkout that replaced the URLs with pointers to my repository in ct/alpine.sh, misc/build.func, and ran the Alpine installer script. ``` ___ __ _ / | / /___ (_)___ ___ / /| | / / __ \/ / __ \/ _ \ / ___ |/ / /_/ / / / / / __/ /_/ |_/_/ .___/_/_/ /_/\___/ /_/ ⚙️ Using Default Settings on node pve 🖥️ Operating System: alpine 🌟 Version: 3.20 📦 Container Type: Unprivileged 💾 Disk Size: 0.1GB 🧠 CPU Cores: 1 🛠️ RAM Size: 512MiB 🆔 Container ID: 112 🚀 Creating a Alpine LXC using the above default settings ✔️ Using local for Template Storage. ✔️ Using local-lvm for Container Storage. ✔️ Updated LXC Template List ✔️ LXC Container 112 was successfully created. ✔️ Started LXC Container ✔️ Set up Container OS ✔️ Network Connected: 192.168.0.129 ✔️ Internet Connected ✔️ DNS Resolved github.com to 4.208.26.197 ✔️ Updated Container OS ✔️ Installed Core Packages ✔️ Customized Container ✔️ Completed Successfully! ``` ``` alpine:~# apk list | grep -E '^(sudo|mc|newt|nano|curl|openssh)-[0-9]' curl-8.11.1-r0 x86_64 {curl} (curl) [installed] mc-4.8.32-r0 x86_64 {mc} (GPL-3.0-or-later) [installed] nano-8.2-r0 x86_64 {nano} (GPL-3.0-or-later) [installed] newt-0.52.24-r1 x86_64 {newt} (LGPL-2.0-only) [installed] openssh-9.9_p1-r2 x86_64 {openssh} (SSH-OpenSSH) [installed] sudo-1.9.16_p2-r0 x86_64 {sudo} (custom ISC) [installed] ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2025-11-20 05:32:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/ProxmoxVE#2947