Skip to content
T Yoshizawa edited this page Feb 20, 2023 · 3 revisions

一般ユーザーの権限でLogitech Media Serverを動作させる方法

#!/usr/bin/env bash
set -e

MISIC_DIR=$(xdg-user-dir MUSIC)
[ -d $MISIC_DIR ] || (
      echo MISIC_DIR is not found.
      echo run LANG=C xdg-user-dirs-update --force
      exit 1
)

podman volume create lms_config || \
podman volume create lms_playlist || \
podman volume create lms_plugins || \
echo volume has already created.


echo "MISIC_DIR: $MISIC_DIR"

HOST_NAME=$(uname -n)-docker
CONTAINER_NAME=LogitechMediaServer

podman rm -f $CONTAINER_NAME || true

# 
podman create --name $CONTAINER_NAME \
      --hostname $HOST_NAME \
      --security-opt label=disable \
      -v lms_playlist:/playlist:rw \
      -v lms_config:/config:rw \
      -v lms_plugins:/config/cache/Plugins:rw \
      -v "$MISIC_DIR":/music:ro \
      -v /etc/localtime:/etc/localtime:ro \
      -p 9000:9000/tcp \
      -p 9091:9091/tcp \
      -p 3483:3483/tcp \
      -p 3483:3483/udp \
      docker.io/lmscommunity/logitechmediaserver

podman start $CONTAINER_NAME

SYSTEMD_CONFIG_USER=$HOME/.config/systemd/user/

[ -d $SYSTEMD_CONFIG_USER ] || mkdir -p $SYSTEMD_CONFIG_USER
pushd $SYSTEMD_CONFIG_USER

podman generate systemd --name --restart-policy always -f $CONTAINER_NAME
echo configs:
ls
popd

systemctl --user enable --now container-$CONTAINER_NAME.service

# ログインしなくてもOS起動時に自動起動できるようにする
#sudo loginctl enable-linger $USER
Clone this wiki locally