Skip to content

Commit

Permalink
fix: add crowsnest log path & pkglist link in postrename script (#235)
Browse files Browse the repository at this point in the history
* fix: add crowsnest log path to postrename script

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* fix: fix crowsnest pkglist sym link in postrename

Signed-off-by: Stefan Dej <meteyou@gmail.com>

---------

Signed-off-by: Stefan Dej <meteyou@gmail.com>
  • Loading branch information
meteyou authored Aug 11, 2023
1 parent 417ed1f commit 7084fd8
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/modules/postrename/filesystem/root/postrename
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ change_www_root() {
"
}


### change username in service files
change_service_user() {
### Filter nginx service first!
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 7084fd8

Please sign in to comment.