summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikos Toutountzoglou2023-02-19 15:11:52 +0100
committerNikos Toutountzoglou2023-02-19 15:11:52 +0100
commiteb5cda89cdc9127a60db21895620cc6d31a9fe56 (patch)
treea2a8ed9752ad6d574777552d97e7bdf694447211
parent7653d27f666a6e5171b9988433f0ebbc637fe06b (diff)
downloadaur-eb5cda89cdc9127a60db21895620cc6d31a9fe56.tar.gz
Remake of wg++.sh shell script. Now includes option to update siteini.pack
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD4
-rw-r--r--[-rwxr-xr-x]wg++.sh168
3 files changed, 99 insertions, 77 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 0cf5e2f9fba5..ec98e7b7f0dc 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = wg++
pkgdesc = WebGrab+Plus is a multi-site incremental xmltv epg grabber
pkgver = 5.0.1.1
- pkgrel = 2
+ pkgrel = 3
url = http://webgrabplus.com/
arch = any
license = custom
@@ -14,6 +14,6 @@ pkgbase = wg++
source = wg++.sh
sha256sums = bea2b13a4a0ae253b6ecb8135abb39dc43dd1cd1acaf7c4cb4241f978874cb41
sha256sums = c6b2e2337323d456cf6097d0e04ce154f709acfe2b9384259a982354cb852e8d
- sha256sums = 3cf9437de0b719c90a92b7651e258b4e26659ba0fe8daf33ae10c4849fa08e18
+ sha256sums = fb57d376425f06a5d471bef556963828185aa86c78096bc597d54bb9eecd66c9
pkgname = wg++
diff --git a/PKGBUILD b/PKGBUILD
index 45080f18f921..c338b09f47c5 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Nikos Toutountzoglou <nikos.toutou@gmail.com>
pkgname=wg++
pkgver=5.0.1.1
-pkgrel=2
+pkgrel=3
pkgdesc="WebGrab+Plus is a multi-site incremental xmltv epg grabber"
arch=('any')
url="http://webgrabplus.com/"
@@ -15,7 +15,7 @@ source=("http://www.webgrabplus.com/sites/default/files/download/SW/V4.2.2/WebGr
"wg++.sh")
sha256sums=('bea2b13a4a0ae253b6ecb8135abb39dc43dd1cd1acaf7c4cb4241f978874cb41'
'c6b2e2337323d456cf6097d0e04ce154f709acfe2b9384259a982354cb852e8d'
- '3cf9437de0b719c90a92b7651e258b4e26659ba0fe8daf33ae10c4849fa08e18')
+ 'fb57d376425f06a5d471bef556963828185aa86c78096bc597d54bb9eecd66c9')
_siteini="https://github.com/SilentButeo2/webgrabplus-siteinipack/trunk/siteini.pack"
prepare() {
diff --git a/wg++.sh b/wg++.sh
index 88bf70c74e30..e9c2c32ae5d7 100755..100644
--- a/wg++.sh
+++ b/wg++.sh
@@ -1,96 +1,118 @@
#!/bin/bash
+# script: wg++ (WebGrab+Plus)
+# author: Nikos Toutountzoglou, nikos.toutou@gmail.com
+# rev.date: 19/02/2023
-#/**
-# * @file wg++
-# * @brief just start WebGrab+Plus
-# * @author WebGrab+Plus Community
-# * @date 31/07/2016
-# * @dotnet version
-# * @date 13/03/2022
-# */
+# vars
+WGPP_USR=$(whoami)
+WGPP_EXE=$(basename $0)
+WGPP_USR_HOME=$(getent passwd "$WGPP_USR" | cut -d: -f6)
+WGPP_CFGDIR=$WGPP_USR_HOME/wg++
+WGPP_SYS=/usr/share/wg++
-CONFIG_DIR=~/wg++
-EXECUTABLE=$(basename $0)
-
-print_help () {
- echo -e "Usage:"
- echo -e "\t$EXECUTABLE - Uses default '$CONFIG_DIR' configuration directory. Will be created if missing."
- echo -e "\t$EXECUTABLE <path> - Path to configuration directory."
- echo -e "\t$EXECUTABLE --help - Show help screen."
- echo -e "\t"
- echo -e "Configuration template is stored in '/usr/share/wg++'. Copy it to your preferred location:"
- echo -e "\tcp -R /usr/share/wg++ /path/to/<configuration_directory>"
+# functions
+helpMsg() {
+ echo "WebGrab+Plus EPG/XMLTV grabber"
+ echo "Usage: $WGPP_EXE [-d|--dir <CUSTOM_DIR>] [-g|--generate] [-d <CUSTOM_DIR> -g] [-u|--update] [-d <CUSTOM_DIR> -u]"
+ echo " $WGPP_EXE -h|-?|--help"
+ echo
+ echo "Options:"
+ echo " -d <CUSTOM_DIR> Run from custom configuration folder <CUSTOM_DIR>."
+ echo " -g Create new configuration folder 'wg++' in user's home directory."
+ echo " -d <CUSTOM_DIR> -g Create new custom configuration folder <CUSTOM_DIR>."
+ echo " -u Update to latest 'siteini.pack' and channel list files."
+ echo " -d <CUSTOM_DIR> -u Update custom configuration folder to latest 'siteini.pack' and channel list files."
}
-# Check if user supplied any arguments
-if [ $# -eq 0 ]; then
- #### User did not provide any arguments to wg++ ####
-
- # Use default config dir "$CONFIG_DIR"
- if [ ! -d "$CONFIG_DIR" ]; then
- cp -R /usr/share/wg++ "$CONFIG_DIR"
- if [ -d "$CONFIG_DIR" ]; then
- echo "Configuration folder '$CONFIG_DIR' created! Run '$EXECUTABLE' again to use it."
- echo "For more information, see '$EXECUTABLE --help'."
- exit 0
- else
- echo "Failed to create configuration folder '$CONFIG_DIR'!"
- print_help
- exit 1
- fi
- fi
-
- # Check if "$CONFIG_DIR" contains configuration file
- if [ ! -f "$CONFIG_DIR/WebGrab++.config.xml" ]; then
- echo "Some configuration files are missing from '$CONFIG_DIR' directory!"
- print_help
- exit 1
+missingSysFiles() {
+ if [ ! -e "$WGPP_CFGDIR/install.sh" -o ! -e "$WGPP_CFGDIR/run.net.sh" ]; then
+ cp -r -u $WGPP_SYS/* "$WGPP_CFGDIR" 2>/dev/null
+ echo ":: Restored missing script files 'install.sh' and/or 'run.net.sh'."
fi
+}
- # Double check if user can read/write "$CONFIG_DIR"
- if [ ! -r "$CONFIG_DIR/WebGrab++.config.xml" ] || [ ! -w "$CONFIG_DIR/WebGrab++.config.xml" ]; then
- echo "You do not have read/write access in '$CONFIG_DIR'."
- print_help
+missingWGPPDir() {
+ if [ ! -d "$WGPP_CFGDIR" ]; then
+ echo ":: No '$WGPP_EXE' working directory found for user '$WGPP_USR', exiting."
exit 1
fi
+}
- dotnet /opt/wg++/bin.net/WebGrab+Plus.dll "$CONFIG_DIR"
-else
- #### User provided arguments to wg++ ####
-
- # Check if there is 1 argument. Exit if more
- if [ $# -ge 2 ]; then
- echo "Invalid path! You need to provide a path to WebGrabber+Plus configuration directory."
- print_help
+custFolder() {
+ if [[ -z "$cust_dir" ]]; then
+ echo ":: Empty custom directory input, exiting."
exit 1
fi
+ WGPP_CFGDIR=$(realpath "$cust_dir")
+}
- # Check if user asked for help
- if [ "$1" == "-h" ] || [ "$1" == "-H" ] || [ "$1" == "--help" ] || [ "$1" == "--HELP" ]; then
- print_help
+genFolder() {
+ if [ ! -d "$WGPP_CFGDIR" ]; then
+ cp -r $WGPP_SYS "$WGPP_CFGDIR"
+ cd "$WGPP_CFGDIR" && sudo -u $WGPP_USR ./install.sh
+ echo ":: Configuration folder '$WGPP_CFGDIR' created."
+ echo ":: It's now possible to configure 'WebGrab++.config.xml' and re-run '$WGPP_EXE' to generate EPG data."
exit 0
- fi
-
- # Check if given parameter is existing directory
- if [ ! -d "$1" ]; then
- echo "Invalid path! You need to provide a path to WebGrabber+Plus configuration directory."
- print_help
+ else
+ echo ":: Configuration folder '$WGPP_CFGDIR' already exists, exiting."
exit 1
fi
+}
- # Check if directory contains configuration file
- if [ ! -f "$1/WebGrab++.config.xml" ]; then
- echo "Wrong path! Your provided path does not contain configuration files."
- print_help
+updateSiteIni() {
+ SITEINI_URL="https://github.com/SilentButeo2/webgrabplus-siteinipack/trunk/siteini.pack"
+
+ if ! type svn > /dev/null; then
+ echo ":: Subversion (svn) is not installed. Please install it first before updating 'siteini.pack'."
exit 1
fi
- # Check if user has read/write access to given path
- if [ ! -r "$1/WebGrab++.config.xml" ] || [ ! -w "$1/WebGrab++.config.xml" ]; then
- echo "You do not have read/write access to your given directory."
- print_help
+ if [ -d "$WGPP_CFGDIR/siteini.pack" ]; then
+ echo ":: Starting update of '$WGPP_CFGDIR/siteini.pack' to latest version."
+ cd "$WGPP_CFGDIR"
+ svn checkout $SITEINI_URL
+ else
+ echo ":: Missing folder 'siteini.pack', exiting."
exit 1
fi
+}
+
+runScript() {
+ cd "$WGPP_CFGDIR"
+ sudo -u $WGPP_USR ./run.net.sh
+}
+
+# args
+args=("$@")
+
+while [ $# -ne 0 ]
+do
+ case "$1" in
+ -d|--dir|-[Dd]ir)
+ shift
+ cust_dir="$1"
+ custFolder
+ ;;
+ -g|--generate|-[Gg]enerate)
+ genFolder
+ ;;
+ -u|--update|-[Uu]pdate)
+ updateSiteIni
+ exit 0
+ ;;
+ -?|--?|-h|--help|-[Hh]elp)
+ helpMsg
+ exit 1
+ ;;
+ *)
+ echo "Unknown argument '$1'"
+ exit 1
+ ;;
+ esac
+ shift
+done
- dotnet /opt/wg++/bin.net/WebGrab+Plus.dll "$1"
-fi
+# run script
+missingWGPPDir
+missingSysFiles
+runScript