aboutsummaryrefslogtreecommitdiff
path: root/update.sh
diff options
context:
space:
mode:
Diffstat (limited to 'update.sh')
-rwxr-xr-xupdate.sh31
1 files changed, 24 insertions, 7 deletions
diff --git a/update.sh b/update.sh
index 6e06e00..b78e062 100755
--- a/update.sh
+++ b/update.sh
@@ -29,10 +29,14 @@
# -ua: Update all that are out of date.
# -uaf: Update all, even if they appear up to date.
+
script_path="$(realpath "$0")"
script_dir="${script_path%/*}"
+
+## Some configuration.
+
# Long names table.
typeset -A long
long[fra]=French
@@ -51,7 +55,7 @@ contrs[fra-eng-bin]=\
contrs[eng-fra-bin]=\
'# Contributor: Benjamin Vanderford <hazor_at_swrpg_dot_info>'$'\n'
-# prepare functions.
+# prepare() functions.
typeset -A prepare
prepare[deu-fra]=\
'prepare()
@@ -65,9 +69,13 @@ prepare[deu-fra]=\
}
'
+## End configuration
+
+
. "${script_dir}/basic.sh"
+
function main
{
if [ "$#" -lt 2 ]
@@ -107,18 +115,19 @@ function main
}
-# $1 source type: (normal|vcs)
-# requires: $PWD == <base directory>/<type>
+# Update PKGBUILD and .SRCINFO
+#
+# requires: $lang, $ext, $type, $ver, $convver to be set;
+# $PWD == <base directory>/<type>/<lang's packaging dir>
+#
function update
{
- src_type=$1
-
echo "Updating ${lang}${ext} (${pkgver} -> ${convver})..."
lang_a="${long[${lang%-*}]}"
lang_b="${long[${lang#*-}]}"
- input ../sample.PKGBUILD
+ input "${script_dir}/${type}/sample.PKGBUILD"
replace '%LANG%' "$lang"
replace '%LANG_A%' "$lang_a"
@@ -141,11 +150,15 @@ function update
}
+# Check for updates for src / bin packages and optionally update them.
+#
# $1 type: (src|bin)
# $2 suffix: (|-bin)
# $3 platform: (src|dictd)
# ${@:4} args: $@
+#
# requires: $PWD == <base directory>
+#
function handle_all
{
type="$1"
@@ -153,7 +166,7 @@ function handle_all
platform="$3"
shift 3
- curl -sO https://freedict.org/freedict-database.json
+ curl -sO https://freedict.org/freedict-database.json || exit 1
cd "$type" || exit 1
@@ -195,10 +208,14 @@ function handle_all
}
+# Check for updates for VCS (svn) packages and optionally update them.
+#
# $1 type: (svn)
# $2 suffix: (-svn)
# ${@:3} args: $@
+#
# requires: $PWD == <base directory>
+#
function handle_all_vcs
{
type="$1"