aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinhard Leichtfuß <alguien@respiranto.de>2018-12-23 16:02:33 +0100
committerEinhard Leichtfuß <alguien@respiranto.de>2018-12-23 16:02:33 +0100
commitb300f3c047a606024db2098523c8fff70721c716 (patch)
tree2cf7ba3456269f5e770c0f0aa40a16dac1ca2a55
parent7e41bec85b1299edd6f7eebb160296e4ec97da81 (diff)
downloadaur-fd-scripts-b300f3c047a606024db2098523c8fff70721c716.tar.gz
aur-fd-scripts-b300f3c047a606024db2098523c8fff70721c716.tar.xz
Use the provided sample.* files
Do not longer rely on them being symlinked to the target directories. Also, fix small error in make_install.sh:main() ($1 -> $2). And add some comments.
-rw-r--r--README10
-rw-r--r--TODO3
-rwxr-xr-xmake_install.sh10
-rwxr-xr-xupdate.sh31
4 files changed, 42 insertions, 12 deletions
diff --git a/README b/README
index b01160f..40689e4 100644
--- a/README
+++ b/README
@@ -9,6 +9,16 @@ Usage:
Just call ./update.sh or ./make_install.sh to see usage information.
+Dependencies:
+-------------
+
+pacman
+bash
+coreutils
+sed
+curl
+
+
Author:
-------
diff --git a/TODO b/TODO
index 3f01a3c..6aaf7d1 100644
--- a/TODO
+++ b/TODO
@@ -3,8 +3,7 @@ TODO file for aur-fd-scripts
[GENERAL]
* Move dictd make dependency to freedict-tools.
* Use updpkgsums from pacman-contrib.
-* Use the provided sample.* instead of relying them to be in the destination
- directories.
+* (Better) error handling.
* [consider] Unify the different sample.PKGBUILDs.
* [consider] Split off a (bash) configuration file.
diff --git a/make_install.sh b/make_install.sh
index 6a3468d..359989c 100755
--- a/make_install.sh
+++ b/make_install.sh
@@ -36,7 +36,7 @@ function main
cd "${1}/${2}" || exit 1
fi
- if [[ "$1" == src ]]
+ if [[ "$2" == src ]]
then
ext=
else
@@ -58,14 +58,18 @@ function main
}
+# Create the install file.
+#
+# requires: $PWD == <base directory>
+#
function make_install
{
pkgname=dict-freedict-${lang}${ext}
- input ../sample.install
+ input "${script_dir}/sample.install"
replace "%LANG%" "$lang"
replace "%SUFFIX%" "$ext"
- write ${pkgname}/${pkgname}.install
+ write "${pkgname}/${pkgname}.install"
}
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"