Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create an empty default welcome file #3194

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions linux/debian/jamulus-headless.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ set -e

adduser --system --quiet --home /nonexistent --no-create-home jamulus

sudo mkdir -p /etc/jamulus
sudo touch /etc/jamulus/welcome.html
Copy link
Collaborator

@pljones pljones Oct 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will require the user to edit the file as root (it is being created by root and both owner and group will be root). The file needs to be readable by the user jamulus, and - depending on how the system is already set up - this may not be the case - it may not be readable others.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

chmod -c 666 /path/to/file

Everyone can read and write, nobody can execute.

Copy link
Collaborator

@pljones pljones Oct 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't want files installed on a system that any user could edit without control, that were then displayed publicly...

Ideally:

  • there would be a jamulus group as well as user
  • the file would be placed in a location owned by the jamulus user and owned by jamulus:jamulus
  • permissions could then be 0660 - so jamulus user and any user in the jamulus group could edit it - but no one else

This is getting outside the scope of this PR, though, so I think just leaving (with -p) will do for now - so only root can edit. It probably is worth making use it's a+r permissions (i.e. anyone can read, other permissions unchanged).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a+r appears to work

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check jamulus.install file and deploy_deb.sh. I think you just need to move the file to the correct location during deb creation. This ensures the file doesn't get overwritten by updates, I suppose

Copy link
Contributor Author

@mcfnord mcfnord Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want my custom welcome file to be overwritten when I upgrade.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. I think that we might want to add an empty file to the deb directly instead of creating it during install time. But I'm unsure about the actual way config files are handled.

For example I'd like that a apt purge deletes it while an apt remove doesn't.

I found https://wiki.debian.org/ConfigPackages but it doesn't help me.

@mirabilos how should config files be handled correctly in deb files?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usual Debian way: ship it as conffile by placing it in /etc/jamulus/ in the package contents, then it will be placed there on first install by dpkg and later updated with newer versions iff the user did not change it; if the user changed it, they’ll get a chance to merge, keep their changes or throw their changes away. And the file will have proper default root:root 0644 permissions.

Copy link
Contributor Author

@mcfnord mcfnord Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ann0see, touch won't overwrite anything. The Debian technique would behave more appropriately with apt purge vs. apt remove, and I guess that's good citizenship. Someday deploying default welcome file metadata could be a thing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mirabilos thanks for answering.

mcfnord marked this conversation as resolved.
Show resolved Hide resolved
chmod a+r /etc/jamulus/welcome.html

#DEBHELPER#
2 changes: 1 addition & 1 deletion linux/debian/jamulus-headless.service
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ IOSchedulingPriority=0

#### Change this to publish this server, set genre, location and other parameters.
#### See https://jamulus.io/wiki/Command-Line-Options ####
ExecStart=/usr/bin/jamulus-headless -s -n
ExecStart=/usr/bin/jamulus-headless -s -n -w /etc/jamulus/welcome.html

Restart=on-failure
RestartSec=30
Expand Down