From 7084fd807b4ccf40cef9335e0bed263f018d2e00 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Fri, 11 Aug 2023 18:27:06 +0200 Subject: [PATCH] fix: add crowsnest log path & pkglist link in postrename script (#235) * fix: add crowsnest log path to postrename script Signed-off-by: Stefan Dej * fix: fix crowsnest pkglist sym link in postrename Signed-off-by: Stefan Dej --------- Signed-off-by: Stefan Dej --- .../postrename/filesystem/root/postrename | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/modules/postrename/filesystem/root/postrename b/src/modules/postrename/filesystem/root/postrename index ea43dc156..4aa394ef8 100644 --- a/src/modules/postrename/filesystem/root/postrename +++ b/src/modules/postrename/filesystem/root/postrename @@ -64,7 +64,6 @@ change_www_root() { " } - ### change username in service files change_service_user() { ### Filter nginx service first! @@ -119,6 +118,13 @@ patch_polkit_rules() { fi } +patch_cn_logpath() { + bash -c " + sed -i 's|/home/pi/printer_data/logs/crowsnest.log|/home/${DEFAULT_USER}/printer_data/logs/crowsnest.log|g' \ + /home/${DEFAULT_USER}/printer_data/config/crowsnest.conf + " +} + patch_cn_logrotate() { if [[ -f "/etc/logrotate.d/crowsnest" ]]; then sed -i 's/pi/'"${DEFAULT_USER}"'/g' "/etc/logrotate.d/crowsnest" @@ -160,6 +166,13 @@ fix_mainsailcfg_links() { ln -sf "${src_dir}/mainsail.cfg" "${config_dir}/mainsail.cfg" } +fix_cn_links() { + local tools_dir + tools_dir="/home/${DEFAULT_USER}/crowsnest/tools/" + sudo -u "${DEFAULT_USER}" \ + ln -sf "${tools_dir}/libs/pkglist-rpi.sh" "${tools_dir}/pkglist.sh" +} + main() { local cmdltxt cmdltxt="/boot/cmdline.txt" @@ -205,6 +218,10 @@ echo -e "${WHITE}Trying to relocate venv's ...${NOC}[${GRE}OK${NOC}]" echo -e "${WHITE}Patching moonraker's polkit rules ...${NOC}" patch_polkit_rules echo -e "${WHITE}Patching moonraker's polkit rules ...${NOC}[${GRE}OK${NOC}]" +## patch crownsnest log path +echo -en "${WHITE}Patching crowsnest logpath ...${NOC}\r" +patch_cn_logpath +echo -e "${WHITE}Patching crowsnest logpath ...${NOC}[${GRE}OK${NOC}]" ## patch crowsnest logrotate echo -e "${WHITE}Patching crowsnest logrotate ...${NOC}" patch_cn_logrotate @@ -214,6 +231,7 @@ echo -en "${WHITE}Fix broken symlinks ...${NOC}\r" fix_broken_links fix_timelapse_links fix_mainsailcfg_links +fix_cn_links echo -e "${WHITE}Fix broken symlinks ...${NOC}[${GRE}OK${NOC}]" ## do a short break sleep 2