Skip to content

Commit

Permalink
Update dietpi-software
Browse files Browse the repository at this point in the history
  • Loading branch information
t3dium authored Oct 24, 2022
1 parent d543d0b commit 0dce043
Showing 1 changed file with 32 additions and 29 deletions.
61 changes: 32 additions & 29 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -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'

This comment has been minimized.

Copy link
@Joulinar

Joulinar Oct 24, 2022

Collaborator

we use ID's instead of names. Have a look to our software list https://github.com/MichaIng/DietPi/wiki/DietPi-Software-list

Anyway, we prefer to install software independent from the chosen web server. Therefore, we like to use webserver as variable for the user choise. Check other apps that require a web server stack like NextCloud or PiHole

#------------------
software_id=38
aSOFTWARE_NAME[$software_id]='FreshRSS'
Expand Down Expand Up @@ -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;

This comment has been minimized.

Copy link
@Joulinar

Joulinar Oct 24, 2022

Collaborator

why not using default setup of a web server and install into /var/www/homer ? There should not be any reason to use a new virt server host.

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

Expand Down Expand Up @@ -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"

This comment has been minimized.

Copy link
@Joulinar

Joulinar Oct 24, 2022

Collaborator

we usually don't inform user if files/folder does not exist. You could make it a one liner

[[ -d '/mnt/dietpi_userdata/Home' ]] && G_EXEC m -Rf /mnt/dietpi_userdata/Homer

btw better to use lower case

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

This comment has been minimized.

Copy link
@Joulinar

Joulinar Oct 24, 2022

Collaborator

same as for folder /mnt/dietpi_userdata/Homer

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"

This comment has been minimized.

Copy link
@Joulinar

Joulinar Oct 24, 2022

Collaborator

usually we don't give such an information to user

fi

software_id=158 # MinIO
Expand Down

0 comments on commit 0dce043

Please sign in to comment.