Hi,

I didn't find any information of how to run CDplayer plugin on official
docker for LMS. Therefore I figured this out myself. Here is what worked
for me if anyone is interested (e.g. future me ;) ). This is for docker
run on Linux host. For other OSes some parts may be different.

First check out the permissions of CDROM device:


Code:
--------------------
    > /usr/bin/ls -l /dev/cdrom
  lrwxrwxrwx 1 root root 3 12-14 10:31 /dev/cdrom -> sr0
  > /usr/bin/ls -l /dev/sr0
  brw-rw---- 1 root optical 11, 0 12-14 10:31 /dev/sr0
--------------------


So anyone in 
Code:
--------------------
    optical
--------------------
 group can read CD. To setup docker we need numerical ID of the group
rather than name, so

Code:
--------------------
    > getent group optical
  optical:x:990:
  
--------------------


We see It is 990.

Let's assume we want to run LMS as -lms- user, which is already present
on host.
Add -lms- user to -optical- group:

Code:
--------------------
    > usermod -aG optical lms
--------------------


Now put the following script in -config- folder of LMS, named
-custom-init.sh-:


Code:
--------------------
    
  cd_group_id=990
  cd_group_name=optical
  lms_user=squeezeboxserver
  
  # Prepare for CDplayer
  
  if ! command -v cdda2wav >/dev/null 2>&1; then
  echo 'Installing icedax (for cdda2wav)'
  apt-get update -qq
  apt-get install --no-install-recommends -qy icedax
  fi
  
  if ! getent group $cd_group_id >/dev/null 2>&1; then
  echo "Adding $cd_group_name($cd_group_id) group"
  groupadd -g $cd_group_id $cd_group_name
  fi
  
  if ! getent group $cd_group_id | grep -q "\b$lms_user\b"; then
  echo "Adding $lms_user user to $cd_group_name group"
  usermod -aG $cd_group_id $lms_user
  fi
  
--------------------


Change 
Code:
--------------------
    cd_group_id
--------------------
 to your group ID. 
Code:
--------------------
    cd_group_name
--------------------
 must not clash with groups already existing in container but otherwise
is irrelevant. 
Code:
--------------------
    lms_user
--------------------
 is the name of user that runs LMS inside container, so must be as it
is.

The script is run *inside container* after container start by sh. It
will install -cdda2wav- and setup permissions so the user that runs LMS
can access host's CDROM device.

The last step is to update docker-compose.yml to add device mapping and
set the user inside the container to have the same ID as our host's
-lms- user:


Code:
--------------------
    > id lms
  uid=972(lms) gid=972(lms) groups=972(lms),990(optical)
  
--------------------


UID is 972.

So add mapping and set user in relevant parts of docker-compose.yml:


Code:
--------------------
    
  services:
  lms:
  device:
  - /dev/cdrom:/dev/cdrom:r
  environment:
  - PUID=972
  
--------------------


------------------------------------------------------------------------
boorg's Profile: http://forums.slimdevices.com/member.php?userid=72375
View this thread: http://forums.slimdevices.com/showthread.php?t=47288

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to