This thread is for combined final development testing and forum preview prior to creation of the releasable package.
In this thread, we will:
Test the system configuration validator.
Test the updated installer.
Test a full CI-built package .
The new validator:
Is generic. It handles both /etc/default/plexmediaserver and /etc/systemd/system/plexmediserver.service.d/*.conf
Ingests your configuration overrides
Adapts to the system’s video group (if not root) and attaches Plex to it
Performs basic existence and permissions testing of the operating enviornment
Reports illegal variables found
Reports conflicting configuration file conditions
The new validator does not:
Write to your system at this time.
This is a point of discussion. The preference is to leave your system as you intend it. Only the most basic changes will be made during initial Plex installation.
The test version shows its actions instead of making any actual changes it normally would during installation / update
Does not require root permission to execute.
The new installer will install both configurations: init and systemd
It will will only link the configuration needed based on pid 1 (init or systemd)
Should you change between the two, it is your responsibility to issue the appropriate update-rc.d or systemctl command(s) as required.
This thread is expected to be lengthy.
There will be a companion thread created with the same sysv-init-testing tag which is strictly for testing the package files as they are build. Issues will be handled there.
Goals:
Try to break it. Look the script over and find ways to break it if possible.
Find out what has been omitted so it can be added.
Let the discussion begin.
Update: 29-Apr-2019
Fixes:
a. init= syntax error
b. systemd / init reporting error
c. Incorrectly selected null PlexGroup
When helping to test the validator, you should be able to create errors / output such as this:
[chuck@lizum init.530]$ ./validate-sysv
Error: Unknown username 'Chuck' used in /etc/systemd/system/plexmediaserver.service.d/override.conf.
Error: Unkown group name 'Chuck' used in /etc/systemd/system/plexmediaserver.service.d/override.conf.
Error: Directory '/home/botswanna/Application Support' in /etc/systemd/system/plexmediaserver.service.d/override.conf does not exist.
SUBSYSTEM=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="0100", GROUP="video" , MODE="0660" > /lib/udev/rules.d/60-tv-butler.rules
SUBSYSTEM=="drm", GROUP="video" , MODE="0660" > /lib/udev/rules.d/60-plex-hw-transcoding.rules
udevadm control --reload-rules
devadm trigger
Validation tests: FAIL
Process Control: Systemd
Plex user: plex
Plex group: plex
Video Group: video
AppSupp Dir: /var/lib/plexmediaserver/Library/Application Support
Config file: /etc/systemd/system/plexmediaserver.service.d/override.conf
[chuck@lizum init.531]$
I would like to validate this for ALL linux systems (systemd and init).
It is my intention to make one base package for all Linux distributions.
This reduces the prerequisites to glibc and a compatible package manager.
Thanks for that catch on my part.
I made the change but didn’t save it DOOH
Here is a deliberate “Break it” test. Fedora 28 (systemd)
[chuck@lizum init.47]$ ./validate-sysv
Error: Unknown username 'Chuck' used in /etc/systemd/system/plexmediaserver.service.d/override.conf.
Error: Unknown group name 'Chuck' used in /etc/systemd/system/plexmediaserver.service.d/override.conf.
Error: Directory '/home/botswanna/Application Support' in /etc/systemd/system/plexmediaserver.service.d/override.conf does not exist.
==SUBSYSTEM=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="0100", GROUP="video" , MODE="0660" > /lib/udev/rules.d/60-tv-butler.rules
==SUBSYSTEM=="drm", GROUP="video" , MODE="0660" > /lib/udev/rules.d/60-plex-hw-transcoding.rules
==udevadm control --reload-rules
==devadm trigger
Validation tests: FAIL
Process Control: Systemd
Plex user: plex
Plex group: plex
Video Group: video
AppSupp Dir: /var/lib/plexmediaserver/Library/Application Support
Config file: /etc/systemd/system/plexmediaserver.service.d/override.conf
[chuck@lizum init.48]$
I am performing a bit of fine tuning assist now and would like input.
Would you like PMS to create the directories specified in your configuration files or simply flag the error if they don’t exist?
I believe it should flag all errors and exit which allows you to correct typos.
Example being:
[chuck@lizum init.56]$ ./postinst-new
Plex Media Server installation validation and configurtion
Error: Directory '/home/chuck/Application Support' in /etc/systemd/system/plexmediaserver.service.d/override.conf does not exist.
System validation tests FAILED.
Please correct the problems found before installing again.
[chuck@lizum init.57]$
A new installation, with a completed and valid configuration file, looks like this and would behave as shown here
[chuck@lizum init.56]$ ./postinst-new
Plex Media Server installation validation and configurtion
Plex now configuring for:
Process Control: Systemd
Plex user: chuck
Plex group: chuck
Video Group: video
Metadata Dir: /home/plexdata
Config file used: /etc/systemd/system/plexmediaserver.service.d/override.conf
HW transcoding: Found
Completing final configuration on your system.
==useradd --quiet --system --shell /bin/bash --home /var/lib/plexmediaserver --group chuck chuck
Warning: "/home/plexdata" is not owned by "chuck".
Please standby while this is corrected.
===chown -R chuck:chuck /home/plexdata
==SUBSYSTEM=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="0100", GROUP="video" , MODE="0660" > /lib/udev/rules.d/60-tv-butler.rules
==SUBSYSTEM=="drm", GROUP="video" , MODE="0660" > /lib/udev/rules.d/60-plex-hw-transcoding.rules
==udevadm control --reload-rules
==udevadm trigger
===systemctl enable plexmediaserver
===systemctl restart plexmediaserver
[chuck@lizum init.57]$
If the directories don’t exist, this is deemed a hard error.
If the directories listed exist, but ownership is incorrect, fix this and continue?
Should there be “Warning” and “Error” ?
Error would be “Does not exist”
Warning would be “incorrect ownership” which is fixable.
If a customization file exists / parameters are not default values, correct discrepancies (Warnings) ?
These are the little tweaks I would like to get ready before first thread-test.
My plan is to have the Debian one available this week, as early as Monday, for evaluation.
It is the easiest to use for testing purposes because plexmediaserver.postinst is freestanding.
The new version was not running for me until I made these changes:
GetHostInfo.sh needs to be sourced in order to pass through the variables back to to the main script.
Line 13 needs to be: source ./GetHostInfo.sh
Output from the script:
Plex Media Server installation validation and configurtion
Warning: PLEX_MEDIA_SERVER_USER is obsolete. Please use PLEX_USER to override the default username in /etc/default/plexmediaserver.
Retaining username: plex
Plex now configuring based on:
Process Control: Init
Plex User: plex
Plex Group: plex
Video Group: video
Metadata Dir: /var/lib/plexmediaserver/Library/Application Support
Temp Directory: /tmp
Lang Encoding: en_US.UTF-8
Config file used: /etc/default/plexmediaserver
HW transcoding: Not found
Completing final configuration on your system.
===groupadd plex
===usermod -a -G plex plex
===usermod -a -G video plex
===SUBSYSTEM==“usb”, ATTRS{idVendor}==“1d19”, ATTRS{idProduct}==“0100”, GROUP=“video” , MODE=“0660” > /lib/udev/rules.d/60-tv-butler.rules
===SUBSYSTEM==“drm”, GROUP=“video” , MODE=“0660” > /lib/udev/rules.d/60-plex-hw-transcoding.rules
===udevadm control --reload-rules
===udevadm trigger
===/usr/sbin/update-rc.d plexmediaserver defaults
===service plexmediaserver restart
Can you include the validate-sysv script to generate errors. I’d like to test more.
The source directive was needed for me to to passthrough the variables made by teh GetHostInfo.sh script. But the ./ was needed for me as well as having “.” in my path is not recommend for security.