From c8c02668b9bd9be22001710314c410414fa26366 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sun, 5 Feb 2023 17:04:59 -0500
Subject: linhes-system: add udev_link.sh

---
 linhes/linhes-system/PKGBUILD     |  5 +++--
 linhes/linhes-system/udev_link.sh | 31 +++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100755 linhes/linhes-system/udev_link.sh

diff --git a/linhes/linhes-system/PKGBUILD b/linhes/linhes-system/PKGBUILD
index d4863b7..c0b7ad0 100755
--- a/linhes/linhes-system/PKGBUILD
+++ b/linhes/linhes-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=linhes-system
 pkgver=9.0.0
-pkgrel=36
+pkgrel=37
 arch=('x86_64')
 #install=$pkgname.install
 pkgdesc="Everything that makes LinHES a system"
@@ -15,7 +15,7 @@ binfiles="add_storage.py balance_storage_groups.py empty_storage_groups.py remov
           misc_recent_recordings.pl misc_status_config.py misc_status_info.sh
           misc_upcoming_recordings.pl misc_which_recorder.pl
           create_media_dirs.sh be_check.py
-          myth2mkv myth2mp3"
+          myth2mkv myth2mp3 udev_link.sh"
 source=($binfiles
     'myth_mtc.cron' 'paccache.cron' 'flatpak_update.cron' 'xfs_defrag.cron'
     'readme_is_xml' 'add_storage.readme' 'LinHES-release'
@@ -48,6 +48,7 @@ sha256sums=('7fd630d58a4268d98648eb7bdcf69a2d53ed326e3b58001d30a42305b04721ed'
             '51093acab5e5a4de51a55f4bdf7b935f4f69edf3d84f1c37db710853ec95eca8'
             '9ea1b5583cd38f53bb79d9e4ccae91a028db0b6850162d7991b19122c564b9c9'
             'a81fdb81d8890e73b7891756623d536a133410ea43205b7152a295ad9ab8f3c9'
+            'ab13f06566d07637c4d221b1afa888b7da458c0adc95db4b9ec5f2798a50ebdc'
             '9e97b4d68c9e8988daacadd40f1de9f0b5945d870eba596a2ceb5e0c023fa9c0'
             '186203d3c0520bb3d611da99d33a7713e9c1563814285f1f101097234f214b2f'
             'd8d36a501928d0cc505957d392291fad317b1e895ff99847d90643cf5f622a89'
diff --git a/linhes/linhes-system/udev_link.sh b/linhes/linhes-system/udev_link.sh
new file mode 100755
index 0000000..7189f06
--- /dev/null
+++ b/linhes/linhes-system/udev_link.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+my_base=$1
+dev_name=$2
+#DEVNAME=/dev/dvb/adapter2/frontend0
+#DVB_ADAPTER_NUM=2
+
+lndir=`dirname $dev_name`
+#for clink in `ls -d /dev/vstatic/dvb*`
+for clink in `ls -d /dev/dvb/adapter_*`
+do
+   if [ `readlink $clink` == $lndir ]
+   then
+       echo "link is already present $clink"
+       exit 0
+   fi
+
+done
+mkdir -p /dev/vstatic
+for i in 1 2 3 4
+do
+    #mydir="/dev/vstatic/${my_base}_$i"
+    mydir="/dev/dvb/adapter_static_${my_base}_$i"
+    if [ ! -e $mydir ]
+    then
+        ln -s $lndir  $mydir
+        exit 0
+    else
+        echo "dvb dir already exists "
+    fi
+done
+exit 0
-- 
cgit v0.12

