Refactor A-B (#15075)

This commit is contained in:
Slaviša Arežina
2026-06-13 18:43:15 +02:00
committed by GitHub
parent 07ab5dc16e
commit d4b9bc86e8
17 changed files with 93 additions and 173 deletions
+7 -7
View File
@@ -35,14 +35,14 @@ function update_script() {
fi
MIGRATE_V1=0
if [[ "$CURRENT_VERSION" == 0.* ]]; then
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}"
read -r -p "Are you sure you want to proceed with the update? (y/N): " proceed
if [[ ! "$proceed" =~ ^[Yy]$ ]]; then
if [[ ! $proceed =~ ^[Yy]$ ]]; then
msg_error "Update cancelled by user."
exit
fi
@@ -53,7 +53,7 @@ function update_script() {
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
if [[ ! $proceed_ram =~ ^[Yy]$ ]]; then
msg_error "Update cancelled by user."
exit
fi
@@ -65,12 +65,12 @@ function update_script() {
systemctl stop bichon
msg_ok "Stopped service"
cp /opt/bichon/bichon.env /tmp/bichon.env.backup
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-*-x86_64-unknown-linux-gnu.tar.gz"
cp /tmp/bichon.env.backup /opt/bichon/bichon.env
restore_backup
msg_info "Updating to intermediate version v0.3.7"
systemctl start bichon
sleep 30
systemctl stop bichon
@@ -78,7 +78,7 @@ function update_script() {
fi
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "bichon" "rustmailer/bichon" "prebuild" "latest" "/opt/bichon" "bichon-*-x86_64-unknown-linux-gnu.tar.gz"
cp /tmp/bichon.env.backup /opt/bichon/bichon.env
restore_backup
if [ "$MIGRATE_V1" -eq 1 ]; then
msg_info "Running Bichon v1 Data Migration (patience)"