mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-07-29 09:12:56 +02:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f2613d062f | |||
| 57c9246f59 |
@@ -508,6 +508,8 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
||||
|
||||
</details>
|
||||
|
||||
## 2026-07-29
|
||||
|
||||
## 2026-07-28
|
||||
|
||||
### 🚀 Updated Scripts
|
||||
|
||||
+1
-2
@@ -42,8 +42,7 @@ function update_script() {
|
||||
/opt/bambuddy/data \
|
||||
/opt/bambuddy/bambuddy.db \
|
||||
/opt/bambuddy/bambutrack.db \
|
||||
/opt/bambuddy/archive \
|
||||
/opt/bambuddy/virtual_printer
|
||||
/opt/bambuddy/archive
|
||||
msg_ok "Backed up Configuration and Data"
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "bambuddy" "maziggy/bambuddy" "tarball" "latest" "/opt/bambuddy"
|
||||
|
||||
+33
-47
@@ -34,30 +34,27 @@ function update_script() {
|
||||
CURRENT_VERSION=$(cat /root/.bichon)
|
||||
fi
|
||||
|
||||
MIGRATE_V1=0
|
||||
if [[ $CURRENT_VERSION == 0.* ]]; then
|
||||
MIGRATE_V1=1
|
||||
DISK_USAGE=$(df / | awk 'NR==2 {print $5}' | sed 's/%//')
|
||||
if [ "$DISK_USAGE" -gt 50 ]; then
|
||||
echo -e "\n${RD}Warning: Less than 50% free storage remaining on the root disk.${CL}"
|
||||
echo -e "${RD}Bichon v1 data migration temporarily duplicates data and requires free space for it.${CL}"
|
||||
if [[ $CURRENT_VERSION != 1.* && $CURRENT_VERSION != 2.* ]]; then
|
||||
msg_error "Installed ${APP} version (${CURRENT_VERSION}) is too old for an automatic update to v2.x."
|
||||
msg_error "Please create a new ${APP} container and migrate your data manually."
|
||||
msg_error "Guide: https://github.com/rustmailer/bichon/wiki/Bichon-v2.x-Migration-Guide"
|
||||
exit
|
||||
fi
|
||||
|
||||
MIGRATE_V2=0
|
||||
if [[ $CURRENT_VERSION == 1.* ]]; then
|
||||
MIGRATE_V2=1
|
||||
STORAGE_KB=$(du -sk /opt/bichon-data/bichon-storage 2>/dev/null | awk '{print $1}')
|
||||
FREE_KB=$(df -Pk /opt/bichon-data | awk 'NR==2 {print $4}')
|
||||
if [[ -n "$STORAGE_KB" && -n "$FREE_KB" && "$FREE_KB" -lt "$STORAGE_KB" ]]; then
|
||||
echo -e "\n${RD}Warning: migration needs about $((STORAGE_KB / 1024))MB, only $((FREE_KB / 1024))MB free.${CL}"
|
||||
echo -e "${RD}The new bichon-blob store is written alongside the existing fjall data.${CL}"
|
||||
read -r -p "Are you sure you want to proceed with the update? (y/N): " proceed
|
||||
if [[ ! $proceed =~ ^[Yy]$ ]]; then
|
||||
msg_error "Update cancelled by user."
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
RAM_TOTAL=$(free -m | awk '/^Mem:/{print $2}')
|
||||
if [ "$RAM_TOTAL" -lt 2000 ]; then
|
||||
echo -e "\n${RD}Warning: LXC has less than 2GB of RAM allocated (${RAM_TOTAL}MB).${CL}"
|
||||
echo -e "${RD}Bichon v1 data migration consumes significant memory and may crash if insufficient.${CL}"
|
||||
read -r -p "Are you sure you want to proceed with the update? (y/N): " proceed_ram
|
||||
if [[ ! $proceed_ram =~ ^[Yy]$ ]]; then
|
||||
msg_error "Update cancelled by user."
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if check_for_gh_release "bichon" "rustmailer/bichon"; then
|
||||
@@ -67,55 +64,44 @@ function update_script() {
|
||||
|
||||
create_backup /opt/bichon/bichon.env
|
||||
|
||||
if [ "$MIGRATE_V1" -eq 1 ] && [ "$CURRENT_VERSION" != "0.3.7" ]; then
|
||||
msg_info "Updating to intermediate version v0.3.7"
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "bichon" "rustmailer/bichon" "prebuild" "v0.3.7" "/opt/bichon" "bichon-*-$(arch_resolve "x86_64" "aarch64")-unknown-linux-gnu.tar.gz"
|
||||
restore_backup
|
||||
systemctl start bichon
|
||||
sleep 30
|
||||
systemctl stop bichon
|
||||
msg_ok "Intermediate update completed"
|
||||
fi
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "bichon" "rustmailer/bichon" "prebuild" "latest" "/opt/bichon" "bichon-*-$(arch_resolve "x86_64" "aarch64")-unknown-linux-gnu.tar.gz"
|
||||
restore_backup
|
||||
|
||||
if [ "$MIGRATE_V1" -eq 1 ]; then
|
||||
msg_info "Running Bichon v1 Data Migration (patience)"
|
||||
if [ "$MIGRATE_V2" -eq 1 ]; then
|
||||
msg_info "Migrating storage from fjall to bichon-blob (patience)"
|
||||
$STD apt install -y expect
|
||||
# Menu: 0 Reset Password, 1 Migrate v0.3.7, 2 Migrate v1.x, 3 Exit
|
||||
$STD expect <<'EOF'
|
||||
set timeout -1
|
||||
spawn /opt/bichon/bichon-admin
|
||||
expect "*Select an operation*"
|
||||
send "\033\[B\r"
|
||||
send "\033\[B\033\[B\r"
|
||||
expect "*--bichon-root-dir*"
|
||||
send "/opt/bichon-data\r"
|
||||
expect "*--bichon-index-dir*"
|
||||
send "\r"
|
||||
expect "*--bichon-data-dir*"
|
||||
send "\r"
|
||||
expect "*Ready to migrate?*"
|
||||
send "y"
|
||||
expect "*Enter batch size*"
|
||||
expect "*batch size*"
|
||||
send "1000\r"
|
||||
expect eof
|
||||
catch wait
|
||||
EOF
|
||||
$STD apt remove --purge expect -y
|
||||
$STD apt autoremove -y
|
||||
msg_ok "Migration completed"
|
||||
|
||||
msg_info "Cleaning up legacy Bichon v0.x storage files"
|
||||
rm -rf /opt/bichon-data/envelope
|
||||
rm -rf /opt/bichon-data/eml
|
||||
rm -f /opt/bichon-data/mailbox.db
|
||||
rm -f /opt/bichon-data/meta.db
|
||||
msg_ok "Cleanup completed"
|
||||
if [[ ! -d /opt/bichon-data/bichon-storage/blobs ]] ||
|
||||
[[ "$(cat /opt/bichon-data/STORAGE_VERSION 2>/dev/null)" != "2" ]]; then
|
||||
msg_error "Storage migration did not complete - service left stopped, legacy data untouched."
|
||||
msg_error "Run /opt/bichon/bichon-admin manually and select 'Migrate v1.x Storage to v2.x'."
|
||||
exit
|
||||
fi
|
||||
msg_ok "Migrated storage to bichon-blob"
|
||||
|
||||
msg_info "Updating Bichon service for v1"
|
||||
sed -i 's|ExecStart=/opt/bichon/bichon|ExecStart=/opt/bichon/bichon-server|g; s|RestartSec=5|RestartSec=5\n\nLimitNOFILE=65536|g' /etc/systemd/system/bichon.service
|
||||
systemctl daemon-reload
|
||||
msg_ok "Service updated"
|
||||
msg_info "Removing legacy fjall files"
|
||||
rm -rf /opt/bichon-data/bichon-storage/keyspaces
|
||||
rm -f /opt/bichon-data/bichon-storage/0.jnl
|
||||
rm -f /opt/bichon-data/bichon-storage/lock
|
||||
rm -f /opt/bichon-data/bichon-storage/version
|
||||
msg_ok "Removed legacy fjall files"
|
||||
fi
|
||||
|
||||
msg_info "Starting service"
|
||||
|
||||
@@ -60,7 +60,7 @@ LimitNOFILE=65536
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now bichon
|
||||
msg_info "Created Service"
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
Reference in New Issue
Block a user