Now that we have a consistent location for our videos, we can install the script responsible for playing them. If you did everything correctly, your USB stick should now be mounted at /media/usb1 automatically at system startup. Make the file executable for the root user using sudo chmod u+x /usr/local/bin/cpmount, then insert your USB stick and reboot. Udev RuleĬreate the file /etc/udev/rules.d/les with the following content: ACTION="add", KERNEL="sd", TAG+="systemd", Systemd ServiceĬreate the file with the following content: Description=Mount USB sticksBindsTo=dev-%i.deviceAfter=dev-%i.deviceType=oneshotRemainAfterExit=yesExecStart=/usr/local/bin/cpmount /dev/%IExecStop=/usr/bin/pumount /dev/%I Mount ScriptĬreate the file /usr/local/bin/cpmount with the following content: #!/bin/bashif mountpoint -q /media/usb1 then if mountpoint -q /media/usb2 then if mountpoint -q /media/usb3 then if mountpoint -q /media/usb4 then echo "No mountpoints available!" else /usr/bin/pmount -umask 000 -noatime -w -sync $1 usb4 fi else /usr/bin/pmount -umask 000 -noatime -w -sync $1 usb3 fi else /usr/bin/pmount -umask 000 -noatime -w -sync $1 usb2 fielse /usr/bin/pmount -umask 000 -noatime -w -sync $1 usb1fi ![]() Install the required pmount package using sudo apt-get install pmount. With a udev rule, systemd service, and mount script, we can ensure that any attached USB stick is not just mounted at boot, but also assigned a predictable mount point. The instructions provided by pauliucxz on StackExchange are perfect for our needs. But since we can't be sure whether the same USB stick will always be used with your Pi, we'll employ a more comprehensive method. There are several ways to accomplish this, especially if you know the device's UUID. Raspberry Pi OS doesn't automatically mount USB storage media by default, so our first step is to enable this behavior. That way, you or your client can easily add and replace videos in the future. Omxplayer will skip videos that exceed these specifications.Ī USB stick is the most logical place to store your video files.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |