mirror of
https://github.com/SynologyOpenSource/pkgscripts-ng.git
synced 2025-07-22 00:34:43 +00:00
54 lines
1.0 KiB
Bash
54 lines
1.0 KiB
Bash
#!/bin/bash
|
|
# Copyright (c) 2000-2020 Synology Inc. All rights reserved.
|
|
|
|
if [ -z "$__INCLUDE_INIT__" ]; then
|
|
__INCLUDE_INIT__=defined
|
|
|
|
CurDir=$(pwd)
|
|
ScriptsDir=$(dirname $(dirname $(readlink -f "${BASH_SOURCE[0]}")))
|
|
ScriptsDirName=$(basename "$ScriptsDir")
|
|
SynoBase=$(dirname "$ScriptsDir")
|
|
BASEDIR="$(dirname "$SynoBase")"
|
|
SourceDir=$SynoBase/source
|
|
|
|
GetChroot() {
|
|
local platform="$1"
|
|
|
|
echo "$BASEDIR/ds.$platform"
|
|
}
|
|
|
|
GetChrootSource() {
|
|
local platform="$1"
|
|
|
|
echo "$(GetChroot "$platform")/source"
|
|
}
|
|
|
|
UsingPkgScripts() {
|
|
if [ "$ScriptsDirName" = "lnxscripts" ]; then
|
|
return 1
|
|
elif [ "$ScriptsDirName" = "branchscripts" ]; then
|
|
return 1
|
|
elif [ "$ScriptsDirName" = "pkgscripts" -o "$ScriptsDirName" = "pkgscripts-ng" ]; then
|
|
return 0
|
|
else
|
|
echo -e "Error! Using lnxscripts or pkgscripts?"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
Source() {
|
|
local script=${ScriptsDir}/$1
|
|
local suffix=$2
|
|
|
|
[ -f "$script" ] && . ${script}
|
|
|
|
if [ -z "$suffix" ]; then
|
|
UsingPkgScripts && suffix=pkg || suffix=lnx
|
|
fi
|
|
|
|
[ -f ${script}.$suffix ] && . ${script}.$suffix
|
|
}
|
|
|
|
fi
|
|
# vim:ft=sh
|