From a8ee844b92874604aaa058512cedb1f8b2658940 Mon Sep 17 00:00:00 2001 From: openhabian Date: Fri, 16 Aug 2024 06:57:21 +0200 Subject: [PATCH] fix rebase artifacts Signed-off-by: openhabian --- functions/find.bash | 5 ---- functions/menu.bash | 17 ------------- functions/zram.bash | 62 --------------------------------------------- 3 files changed, 84 deletions(-) diff --git a/functions/find.bash b/functions/find.bash index ec7928904..e947eea72 100644 --- a/functions/find.bash +++ b/functions/find.bash @@ -93,12 +93,7 @@ find3_setup() { if ! cond_redirect zram_dependency install find3server find3ai; then return 1; fi if [[ -f /etc/ztab ]] && ! grep -qs "/find3.bind" /etc/ztab; then echo -n "$(timestamp) [openHABian] Adding FIND3 to zram... " -<<<<<<< HEAD if ! cond_redirect sed -i '/^.*persistence.bind$/a dir zstd 150M 350M /opt/find3/server/main /find3.bind' /etc/ztab; then echo "FAILED (sed)"; return 1; fi -======= - if ! cond_redirect mv /etc/ztab "${TMPDIR:-/tmp}"; then echo "FAILED (move old configuration)"; return 1; fi - if ! (echo "dir lz4 100M 350M /opt/find3/server/main /find3.bind" > /etc/ztab); then echo "FAILED (temporary configuration creation)"; return 1; fi ->>>>>>> febbbeb5d (Update all documentation for clarity and accuracy (#1443)) if ! cond_redirect zram-config "start"; then echo "FAILED (start temporary configuration)"; return 1; fi fi diff --git a/functions/menu.bash b/functions/menu.bash index be3cdeb1b..1a271fbea 100644 --- a/functions/menu.bash +++ b/functions/menu.bash @@ -167,7 +167,6 @@ show_main_menu() { "32 | Set system locale" "Change system language, currently '$(env | grep "^[[:space:]]*LANG=" | sed 's|LANG=||g')'" \ "33 | Set system timezone" "Change your timezone, execute if it's not '$(printf "%(%H:%M)T\\n" "-1")' now" \ "34 | Change passwords" "Change passwords for Samba, openHAB Console or the system user" \ -<<<<<<< HEAD "35 | Serial port" "Prepare serial ports for peripherals like RaZberry, ZigBee adapters etc" \ "36 | Disable framebuffer" "Disable framebuffer on RPi to minimize memory usage" \ " | Enable framebuffer" "Enable framebuffer (standard setting)" \ @@ -177,16 +176,6 @@ show_main_menu() { "39 | Move root to USB" "Move the system root from the SD card to a USB device (SSD or stick)" \ "3A | Setup Exim Mail Relay" "Install Exim4 to relay mails via public email provider" \ "3B | Setup Tailscale VPN" "Establish or join a WireGuard based VPN using the Tailscale service" \ -======= - "35 | Serial port" "Prepare serial ports for peripherals like Razberry, SCC, Pine64 ZWave, ..." \ - "36 | WiFi setup" "Configure wireless network connection" \ - " | Disable WiFi" "Disable wireless network connection" \ - "37 | Move root to USB" "Move the system root from the SD card to a USB device (SSD or stick)" \ - "38 | Use zram" "Use compressed RAM/disk sync for active directories to avoid SD card corruption" \ - " | Uninstall zram" "Don't use compressed memory (back to standard Raspberry Pi OS filesystem layout)" \ - "39 | Setup Exim Mail Relay" "Install Exim4 to relay mails via public email provider" \ - "3A | Setup Tailscale VPN" "Establish or join a WireGuard based VPN using the Tailscale service" \ ->>>>>>> febbbeb5d (Update all documentation for clarity and accuracy (#1443)) " | Remove Tailscale VPN" "Remove the Tailscale VPN service" \ " | Install WireGuard" "Setup WireGuard to enable secure remote access to this system" \ " | Remove WireGuard" "Remove WireGuard VPN from this system" \ @@ -203,17 +192,11 @@ show_main_menu() { 36\ *) use_framebuffer "disable" ;; *Enable\ framebuffer) use_framebuffer "enable" ;; 38\ *) init_zram_mounts "install" ;; -<<<<<<< HEAD *Update\ zram) init_zram_mounts ;; *Uninstall\ zram) init_zram_mounts "uninstall" ;; 39\ *) move_root2usb ;; 3A\ *) exim_setup ;; 3B\ *) if install_tailscale install; then setup_tailscale; fi;; -======= - *Uninstall\ zram) init_zram_mounts "uninstall" ;; - 39\ *) exim_setup ;; - 3A\ *) if install_tailscale install; then setup_tailscale; fi;; ->>>>>>> febbbeb5d (Update all documentation for clarity and accuracy (#1443)) *Remove\ Tailscale*) install_tailscale remove;; *Install\ WireGuard*) if install_wireguard install; then setup_wireguard; fi;; *Remove\ WireGuard*) install_wireguard remove;; diff --git a/functions/zram.bash b/functions/zram.bash index 79269a5cc..921ab6d5e 100644 --- a/functions/zram.bash +++ b/functions/zram.bash @@ -27,11 +27,6 @@ install_zram_code() { init_zram_mounts() { if ! is_arm; then return 0; fi -<<<<<<< HEAD -======= - local disklistFileAWS="/etc/amanda/openhab-aws/disklist" - local disklistFileDir="/etc/amanda/openhab-dir/disklist" ->>>>>>> febbbeb5d (Update all documentation for clarity and accuracy (#1443)) local introText="You are about to activate the zram feature.\\nBe aware you do this at your own risk of data loss.\\nPlease check out the \"zram status\" thread at https://community.openhab.org/t/zram-status/80996 before proceeding." local lowMemText="Your system has less than 1 GB of RAM. It is definitely NOT recommended to run zram (AND openHAB) on your box. If you proceed now you will do so at your own risk!" local zramInstallLocation="/opt/zram" @@ -46,15 +41,9 @@ init_zram_mounts() { fi fi -<<<<<<< HEAD if ! dpkg -s 'meson' &> /dev/null; then echo -n "$(timestamp) [openHABian] Installing zram required package (meson)... " if cond_redirect apt-get install --yes -o DPkg::Lock::Timeout="$APTTIMEOUT" meson; then echo "OK"; else echo "FAILED"; return 1; fi -======= - if ! dpkg -s 'make' 'libattr1-dev' &> /dev/null; then - echo -n "$(timestamp) [openHABian] Installing zram required packages (make, libattr1-dev)... " - if cond_redirect apt-get install --yes make libattr1-dev; then echo "OK"; else echo "FAILED"; return 1; fi ->>>>>>> febbbeb5d (Update all documentation for clarity and accuracy (#1443)) fi install_zram_code "$zramInstallLocation" @@ -74,10 +63,7 @@ init_zram_mounts() { if ! cond_redirect install -m 644 "${BASEDIR:-/opt/openhabian}"/includes/ztab /etc/ztab; then echo "FAILED (ztab)"; return 1; fi fi -<<<<<<< HEAD -======= echo -n "$(timestamp) [openHABian] Setting up zram... " ->>>>>>> febbbeb5d (Update all documentation for clarity and accuracy (#1443)) if ! cond_redirect install -m 755 "$zramInstallLocation"/zram-config/zram-config /usr/local/sbin; then echo "FAILED (zram-config)"; return 1; fi if ! cond_redirect install -m 644 "$zramInstallLocation"/zram-config/service/SystemD/zram-config.service /etc/systemd/system/zram-config.service; then echo "FAILED (install zram-config.service)"; return 1; fi if ! cond_redirect install -m 755 "${BASEDIR:-/opt/openhabian}"/zram-sync /usr/local/sbin; then echo "FAILED (install ZRAM sync script)"; return 1; fi @@ -92,47 +78,23 @@ init_zram_mounts() { if [[ -f /etc/systemd/system/find3server.service ]]; then echo -n "$(timestamp) [openHABian] Adding FIND3 to zram... " -<<<<<<< HEAD if cond_redirect sed -i '/^.*persistence.*$/a dir zstd 150M 350M /opt/find3/server/main /find3.bind' /etc/ztab; then echo "OK"; else echo "FAILED (sed)"; return 1; fi fi if [[ -f /lib/systemd/system/influxdb.service ]]; then echo -n "$(timestamp) [openHABian] Adding InfluxDB to zram... " if cond_redirect sed -i '/^.*persistence.*$/a dir zstd 150M 350M /var/lib/influxdb /influxdb.bind' /etc/ztab; then echo "OK"; else echo "FAILED (sed)"; return 1; fi -======= - if cond_redirect sed -i '/^.*persistence.bind$/a dir lz4 100M 350M /opt/find3/server/main /find3.bind' /etc/ztab; then echo "OK"; else echo "FAILED (sed)"; return 1; fi ->>>>>>> febbbeb5d (Update all documentation for clarity and accuracy (#1443)) fi mkdir -p /var/log/nginx # ensure it exists on lowerfs else nginx may fail to start if zram is not synced after nginx install if ! openhab_is_installed; then echo -n "$(timestamp) [openHABian] Removing openHAB persistence from zram... " -<<<<<<< HEAD if cond_redirect sed -i '/^.*persistence.*$/d' /etc/ztab; then echo "OK"; else echo "FAILED (sed)"; return 1; fi fi echo -n "$(timestamp) [openHABian] Setting up zram service... " if ! cond_redirect install -m 644 "$zramInstallLocation"/zram-config/service/SystemD/zram-config.service /etc/systemd/system/zram-config.service; then echo "FAILED (install service)"; return 1; fi if ! cond_redirect systemctl -q daemon-reload; then echo "FAILED (daemon-reload)"; return 1; fi -======= - if cond_redirect sed -i '/persistence.bind/d' /etc/ztab; then echo "OK"; else echo "FAILED (sed)"; return 1; fi - else - if [[ -f $disklistFileDir ]]; then - echo -n "$(timestamp) [openHABian] Adding zram to Amanda local backup... " - if ! cond_redirect sed -i '/zram/d' "$disklistFileDir"; then echo "FAILED (old config)"; return 1; fi - if (echo "${HOSTNAME} /opt/zram/persistence.bind comp-user-tar" >> "$disklistFileDir"); then echo "OK"; else echo "FAILED (new config)"; return 1; fi - fi - if [[ -f $disklistFileAWS ]]; then - echo -n "$(timestamp) [openHABian] Adding zram to Amanda AWS backup... " - if ! cond_redirect sed -i '/zram/d' "$disklistFileAWS"; then echo "FAILED (old config)"; return 1; fi - if (echo "${HOSTNAME} /opt/zram/persistence.bind comp-user-tar" >> "$disklistFileAWS"); then echo "OK"; else echo "FAILED (new config)"; return 1; fi - fi - fi - - echo -n "$(timestamp) [openHABian] Setting up zram service... " - if ! cond_redirect install -m 644 "$zramInstallLocation"/zram-config/zram-config.service /etc/systemd/system/zram-config.service; then echo "FAILED (install service)"; return 1; fi - if ! cond_redirect systemctl -q daemon-reload &> /dev/null; then echo "FAILED (daemon-reload)"; return 1; fi ->>>>>>> febbbeb5d (Update all documentation for clarity and accuracy (#1443)) if ! running_in_docker && ! running_on_github; then if ! cond_redirect systemctl mask unattended-upgrades.service; then echo "FAILED (mask unattended upgrades service)"; return 1; fi @@ -140,16 +102,10 @@ init_zram_mounts() { if cond_redirect systemctl enable --now zram-config.service; then echo "OK"; else echo "FAILED (enable service)"; return 1; fi elif [[ $1 == "uninstall" ]]; then echo -n "$(timestamp) [openHABian] Removing zram service... " -<<<<<<< HEAD if ! cond_redirect systemctl stop zram-config.service zsync.service; then echo "FAILED (stop zram)"; return 1; fi if ! cond_redirect systemctl disable zram-config.service zsync.service; then echo "FAILED (disable service)"; return 1; fi if ! cond_redirect rm -f "/etc/systemd/system/{zram-config,zsync}.service"; then echo "FAILED (remove service)"; return 1; fi if ! cond_redirect sed -i '\|^ReadWritePaths=/usr/local/share/zram-config/log$|d' /lib/systemd/system/logrotate.service; then echo "FAILED (sed)"; return 1; fi -======= - if ! cond_redirect zram-config "stop"; then echo "FAILED (stop zram)"; return 1; fi - if ! cond_redirect systemctl disable zram-config.service; then echo "FAILED (disable service)"; return 1; fi - if ! cond_redirect rm -f /etc/systemd/system/zram-config.service; then echo "FAILED (remove service)"; return 1; fi ->>>>>>> febbbeb5d (Update all documentation for clarity and accuracy (#1443)) if ! running_in_docker && ! running_on_github; then if ! cond_redirect systemctl unmask unattended-upgrades.service; then echo "FAILED (unmask unattended upgrades service)"; return 1; fi fi @@ -177,7 +133,6 @@ init_zram_mounts() { if ! cond_redirect meson install -C "$zramInstallLocation"/zram-config/overlayfs-tools/builddir; then echo "FAILED (meson install)"; return 1; fi if cond_redirect mkdir -p /usr/local/lib/zram-config/; then echo "OK"; else echo "FAILED (create directory)"; return 1; fi -<<<<<<< HEAD echo -n "$(timestamp) [openHABian] Updating zram logging files... " if ! cond_redirect mkdir -p /usr/local/share/zram-config/log; then echo "FAILED (create directory)"; return 1; fi if ! [[ -h /var/log/zram-config ]]; then @@ -186,24 +141,11 @@ init_zram_mounts() { if ! cond_redirect install -m 644 "$zramInstallLocation"/zram-config/service/zram-config.logrotate /etc/logrotate.d/zram-config; then echo "FAILED (logrotate)"; return 1; fi if ! grep -qs "ReadWritePaths=/usr/local/share/zram-config/log" /lib/systemd/system/logrotate.service; then echo "ReadWritePaths=/usr/local/share/zram-config/log" >> /lib/systemd/system/logrotate.service -======= - if [[ -f "$disklistFileDir" ]]; then - echo -n "$(timestamp) [openHABian] Removing zram from Amanda local backup... " - if cond_redirect sed -i -e '/zram/d' "$disklistFileDir"; then echo "OK"; else echo "FAILED (old config)"; return 1; fi - fi - if [[ -f "$disklistFileAWS" ]]; then - echo -n "$(timestamp) [openHABian] Removing zram from Amanda AWS backup... " - if cond_redirect sed -i -e '/zram/d' "$disklistFileAWS"; then echo "OK"; else echo "FAILED (old config)"; return 1; fi ->>>>>>> febbbeb5d (Update all documentation for clarity and accuracy (#1443)) fi if ! cond_redirect systemctl -q daemon-reload; then echo "FAILED (daemon-reload)"; return 1; fi if cond_redirect systemctl restart zram-config.service; then echo "OK"; else echo "FAILED (start service)"; return 1; fi else -<<<<<<< HEAD echo "$(timestamp) [openHABian] Refusing to update zram as it is not installed, please install and then try again... EXITING" -======= - echo "$(timestamp) [openHABian] Refusing to install zram as it is already installed, please uninstall and then try again... EXITING" ->>>>>>> febbbeb5d (Update all documentation for clarity and accuracy (#1443)) return 1 fi } @@ -214,11 +156,7 @@ zram_setup() { return 1 fi if is_arm; then -<<<<<<< HEAD if ! has_lowmem && ! is_pione && ! is_cmone && ! is_pizero && ! is_pizerow && ! is_pizerow2; then -======= - if ! has_lowmem && ! is_pione && ! is_cmone && ! is_pizero && ! is_pizerow; then ->>>>>>> febbbeb5d (Update all documentation for clarity and accuracy (#1443)) echo -n "$(timestamp) [openHABian] Installing zram... " if cond_redirect init_zram_mounts "install"; then echo "OK"; else echo "FAILED"; return 1; fi else