From 0dce04374447a53bd5bbd98f0347c5ec914a780b Mon Sep 17 00:00:00 2001 From: Faraz Ahary <83690012+t3dium@users.noreply.github.com> Date: Mon, 24 Oct 2022 21:34:55 +0100 Subject: [PATCH] Update dietpi-software --- dietpi/dietpi-software | 61 ++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 597180fba8..10d6dfc06d 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -974,7 +974,8 @@ Available commands: aSOFTWARE_NAME[$software_id]='Homer' aSOFTWARE_DESC[$software_id]='A homepage for your services' aSOFTWARE_CATX[$software_id]=6 - aSOFTWARE_DOCS[$software_id]='https://github.com/bastienwirtz/homer' + aSOFTWARE_DOCS[$software_id]='https://dietpi.com/docs/software/homepages/#Homer' + aSOFTWARE_DEPS[$software_id]='nginx' #------------------ software_id=38 aSOFTWARE_NAME[$software_id]='FreshRSS' @@ -12330,32 +12331,27 @@ _EOF_ Banner_Installing - # installing nginx and ensuring it starts at boot - sudo apt install nginx -y - sudo systemctl enable nginx + # checking if a previous installation already exists + if [ -d "/mnt/dietpi_userdata/Homer" ]; then + G_DIETPI-NOTIFY 1 "IMPORTANT - previous installation found, backed up to /tmp/homer-backup and overwrote current data. To recover configs, view files at /tmp/homer-backup" + G_EXEC cp -r /mnt/dietpi_userdata/Home /tmp/homer-backup + fi # installing homer - wget "https://github.com/bastienwirtz/homer/releases/latest/download/homer.zip" - sudo unzip homer.zip -d /mnt/dietpi_userdata/Homer/ - sudo cp /usr/share/nginx/homer/assets/config.yml.dist /mnt/dietpi_userdata/Homer/assets/config.yml - - #create nginx config - echo line by line to conf - sudo echo "server {" >> /etc/nginx/conf.d/homer.conf - sudo echo " listen 49157;" >> /etc/nginx/conf.d/homer.conf - sudo echo " listen [::]:49157;" >> /etc/nginx/conf.d/homer.conf - sudo echo " root /mnt/dietpi_userdata/Homer/;" >> /etc/nginx/conf.d/homer.conf - sudo echo " access_log /var/log/nginx/homer.access;" >> /etc/nginx/conf.d/homer.conf - sudo echo " error_log /var/log/nginx/homer.error;" >> /etc/nginx/conf.d/homer.conf - sudo echo "}" >> /etc/nginx/conf.d/homer.conf - - - #fix permissions - sudo chown www-data:www-data /usr/share/nginx/homer/ -R + Download_Install 'https://github.com/bastienwirtz/homer/releases/latest/download/homer.zip' /mnt/dietpi_userdata/homer + G_EXEC cp /mnt/dietpi_userdata/Homer/assets/config.yml.dist /mnt/dietpi_userdata/Homer/assets/config.yml - #run - sudo systemctl reload nginx + #create nginx config + cat << '_EOF_' > /etc/nginx/conf.d/homer.conf +server { + listen 49157; + listen [::]:49157; + + root /mnt/dietpi_userdata/Homer/; +} +_EOF_ - echo "installed homer, you may access it from YOUR_PRIVATE_IP_HERE:49157" + G_DIETPI-NOTIFY 0 "installed homer, you may access it from YOUR_PRIVATE_IP_HERE:49157" fi @@ -15186,15 +15182,22 @@ _EOF_ Banner_Uninstalling - sudo systemctl stop nginx - sudo rm -rf /mnt/dietpi_userdata/Homer - sudo rm /etc/nginx/conf.d/homer.conf + # checking if directories exist before removing - systemctl start nginx + if [ -d "/mnt/dietpi_userdata/Homer" ]; then + G_EXEC rm -rf /mnt/dietpi_userdata/Homer + else + G_DIETPI-NOTIFY 1 "/mnt/dietpi_userdata/Homer doesn't exist, skipping" + fi - # not removing nginx as it could be used for other software - echo "uninstalled homer, nginx has not been removed as it may be used by other software, u can remove it manually by sudo apt remove nginx -y" + if [ -d "/etc/nginx/conf.d/homer.conf" ]; then + G_EXEC rm /etc/nginx/conf.d/homer.conf + else + G_DIETPI-NOTIFY 1 "/etc/nginx/conf.d/homer.conf doesn't exist, skipping" + fi + # not removing nginx as it could be used for other software + G_DIETPI-NOTIFY 0 "uninstalled homer, nginx has not been removed as it may be used by other software, u can remove it manually by sudo apt remove nginx -y" fi software_id=158 # MinIO