Skip to content

Commit

Permalink
fix rebase artifacts
Browse files Browse the repository at this point in the history
Signed-off-by: openhabian <openhabian@openHABian>
  • Loading branch information
openhabian authored and openhabian committed Aug 16, 2024
1 parent 7c4fec6 commit a8ee844
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 84 deletions.
5 changes: 0 additions & 5 deletions functions/find.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 0 additions & 17 deletions functions/menu.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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)" \
Expand All @@ -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" \
Expand All @@ -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;;
Expand Down
62 changes: 0 additions & 62 deletions functions/zram.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -92,64 +78,34 @@ 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
fi
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
Expand Down Expand Up @@ -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
Expand All @@ -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
}
Expand All @@ -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
Expand Down

0 comments on commit a8ee844

Please sign in to comment.