Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beta v4.2.8 #173

Merged
merged 27 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion VMs/example
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

IP="111.111.111.111"
USER="root"
SSH_VM_PORT="22
SSH_VM_PORT="22"
# Time in secounds
SSH_START_DELAY_TIME="45"
16 changes: 13 additions & 3 deletions change.log
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
Changelog:
==========

**v4.2.5** (beta)
- fix ioBroker Upgrade
- fix arch upgrade
**v4.2.8** (beta)
- add freebsd VM (QEMO and SSH Connection)
- add non root user update in VMs
- add autoclean for debian based systems
- add filesystem trim for ext4 systems
- fix ioBroker Upgrade
- fix arch upgrade
- fix START/STOP/WAITING for stopped VMs
- fix compatibility with "old" ssh connection
- fix IP output by nodes
- fix fedora autoremove
- fix missing kernel infos
- fix template detection
- fix internet check
- code cleaning

**v4.2** (01.12.2024)
- fix VM Template error
Expand Down
16 changes: 13 additions & 3 deletions check-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,14 @@ CHECK_VM () {
if ! (ssh "$IP" exit) >/dev/null 2>&1; then
CHECK_VM_QEMU
else
OS_BASE=$(qm config "$VM" | grep ostype)
OS_BASE=$(qm config "$VM" | grep ostype || true)
if [[ "$OS_BASE" =~ l2 ]]; then
OS=$(ssh "$IP" hostnamectl | grep System)
KERNEL=$(qm guest cmd "$VM" get-osinfo | grep kernel-version || true)
OS=$(ssh "$IP" hostnamectl | grep System || true)
# if [[ "$KERNEL" =~ FreeBSD ]]; then
# ssh -t -q -p "$SSH_VM_PORT" -tt "$USER"@"$IP" pkg update
# return
# fi
if [[ "$OS" =~ Ubuntu ]] || [[ "$OS" =~ Debian ]] || [[ "$OS" =~ Devuan ]]; then
ssh "$IP" "apt-get update" >/dev/null 2>&1
SECURITY_APT_UPDATES=$(ssh "$IP" "apt-get -s upgrade | grep -ci ^inst.*security")
Expand Down Expand Up @@ -299,7 +304,12 @@ CHECK_VM () {

CHECK_VM_QEMU () {
if qm guest exec "$VM" test >/dev/null 2>&1; then
OS=$(qm guest cmd "$VM" get-osinfo | grep name)
KERNEL=$(qm guest cmd "$VM" get-osinfo | grep kernel-version || true)
OS=$(qm guest cmd "$VM" get-osinfo | grep name || true)
# if [[ "$KERNEL" =~ FreeBSD ]]; then
# qm guest exec "$VM" -- tcsh -c "pkg update"
# return
# fi
if [[ "$OS" =~ Ubuntu ]] || [[ "$OS" =~ Debian ]] || [[ "$OS" =~ Devuan ]]; then
qm guest exec "$VM" -- bash -c "apt-get update" >/dev/null 2>&1
SECURITY_APT_UPDATES=$(qm guest exec "$VM" -- bash -c "apt-get -s upgrade | grep -ci ^inst.*security | tr -d '\n'" | tail -n +4 | head -n -1 | cut -c 18- | rev | cut -c 2- | rev)
Expand Down
3 changes: 2 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# shellcheck disable=SC1017
# shellcheck disable=SC2034

VERSION="1.8.1"
VERSION="1.8.2"

# Branch
BRANCH="beta"
Expand Down Expand Up @@ -247,6 +247,7 @@ UPDATE () {
# Copy files
mv "$TEMP_FILES"/update.sh $LOCAL_FILES/update.sh
chmod 750 $LOCAL_FILES/update.sh
mv "$TEMP_FILES"/VMs/example $LOCAL_FILES/VMs/example
if [[ -f /etc/update-motd.d/01-welcome-screen ]]; then
mv "$TEMP_FILES"/welcome-screen.sh /etc/update-motd.d/01-welcome-screen
chmod +x /etc/update-motd.d/01-welcome-screen
Expand Down
37 changes: 25 additions & 12 deletions ssh.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,36 @@ PermitRootLogin yes
`sudo service sshd restart`


### IN HOST:
- create one file per VM in `/etc/ultimate-updater/VMs/<ID>` with content:
### IN HOST who hosted the VM:
- Copy ssh key to VM:
`ssh-copy-id -i /root/.ssh/id_rsa.pub root@<VM-IP>`

`IP="111.111.111.111"` # use the IP from the VM!
`USER="root"`
`SSH_VM_PORT="22`
- or, if used user is not root:
`ssh-copy-id -i /root/.ssh/id_rsa.pub <user>@<VM-IP>`


### IN HOST where ultimate-updater start:
- create one file per VM in `/etc/ultimate-updater/VMs/<ID>` with content:

```
IP="111.111.111.111" # use the IP from the VM!
USER="root"
SSH_VM_PORT="22"
SSH_START_DELAY_TIME="45"
```
(IP can be found in VM with command: `hostname -I`)

## if user is NOT root you need to prepare the user to run update commands like `apt` without sudo.
for example look here: `https://askubuntu.com/questions/74054/run-apt-get-without-sudo`

- Copy ssh key to VM:
## If user is NOT root, you need to prepare the user, to run admin commands - like `apt` - but user MUST be part of group `sudo`

You need to make this step on the Host, who hosted the VM. If pve2 host VMxyz, you need to make the copy from pve2, not from the pve, on which you run the script ;)
Example for Ubuntu/Debian - with sudo (change in VM):

`ssh-copy-id -i /root/.ssh/id_rsa.pub root@<VM-IP>`
or
`ssh-copy-id -i /root/.ssh/id_rsa.pub user@<VM-IP>`
- `sudo visudo`
- add this to file:

`%sudo ALL=(root) NOPASSWD: /usr/bin/apt-get update, /usr/bin/apt-get upgrade -y, /usr/bin/apt-get --purge autoremove -y, /usr/bin/apt-get autoclean -y`
- save and exit file

Sources:
- easy, but unsafe -> look [here](https://askubuntu.com/questions/74054/run-apt-get-without-sudo)
- for more safety -> look [here](https://stackoverflow.com/questions/73397309/how-do-i-enable-passwordless-sudo-for-all-options-for-a-command):
2 changes: 1 addition & 1 deletion update.conf
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ FSTRIM_WITH_MOUNTPOINT="true"
INCLUDE_KERNEL="true" # not included for now
INCLUDE_KERNEL_CLEAN="true" # true only in develop

VM_START_DELAY="45" # in secounds
VM_START_DELAY="45" # in secounds - for QEMU - not SSH

┌──────────────────────────────────────────────┐
│ Only/Exclude LXC and/or VM │
Expand Down
Loading
Loading