aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinhard Leichtfuß <alguien@respiranto.de>2018-12-23 17:59:31 +0100
committerEinhard Leichtfuß <alguien@respiranto.de>2018-12-23 18:02:41 +0100
commit578c30417de768429e7a75eb8d30c5982043d3b0 (patch)
treef94b12f063af28ac2f8119e54cb5f32281232fa1
parent53fc988c4110e5a809d5780483c6a072c2dfae4e (diff)
downloadaur-fd-scripts-578c30417de768429e7a75eb8d30c5982043d3b0.tar.gz
aur-fd-scripts-578c30417de768429e7a75eb8d30c5982043d3b0.tar.xz
Split off config.sh and add maintainer variable
Now, other people than myself might be maintainer. Also, add `| exit 1' to the sourcing of scripts. Furthermore, add note to the scripts in the sample.* files.
-rw-r--r--TODO2
-rw-r--r--basic.sh17
-rw-r--r--bin/sample.PKGBUILD5
-rwxr-xr-xconfig.default.sh75
-rwxr-xr-xmake_install.sh2
-rw-r--r--sample.install2
-rw-r--r--src/sample.PKGBUILD5
-rw-r--r--svn/sample.PKGBUILD5
-rwxr-xr-xupdate.sh54
9 files changed, 96 insertions, 71 deletions
diff --git a/TODO b/TODO
index b838630..84528b1 100644
--- a/TODO
+++ b/TODO
@@ -6,13 +6,11 @@ TODO file for aur-fd-scripts
* (Better) error handling.
* Avoid looping over all packages when only one is to be updated.
* [consider] Unify the different sample.PKGBUILDs.
-* [consider] Split off a (bash) configuration file.
[FEATURES]
* Check for update of freedict-tools.
* Increase / keep pkgrel if the version does not increase.
`- `keep' should be a non-default option.
-* Allow for other maintainers than myself.
* Set up directory structure if not existing.
* [consider] Notify on checksum change (should not happen unless version
numbers change).
diff --git a/basic.sh b/basic.sh
index 0cb5186..91c49cd 100644
--- a/basic.sh
+++ b/basic.sh
@@ -25,21 +25,12 @@
# All methods operate on the file "$tmp".
-# Dictionaries in the VCS tree, GPL2 assumed.
-typeset -a vcs_langs
-vcs_langs=(
- deu-eng eng-deu
- fra-eng eng-fra
- spa-eng eng-spa
- )
-typeset -a wikdict_langs
-wikdict_langs=(
- fra-deu deu-fra
- )
+script_path="$(realpath "$0")"
+script_dir="${script_path%/*}"
+
+. "${script_dir}/config.sh" || exit 1
-typeset -a langs
-langs=( ${vcs_langs[@]} ${wikdict_langs[@]} )
function init
{
diff --git a/bin/sample.PKGBUILD b/bin/sample.PKGBUILD
index 7b72147..01b6b3f 100644
--- a/bin/sample.PKGBUILD
+++ b/bin/sample.PKGBUILD
@@ -1,5 +1,8 @@
-# Maintainer: Einhard Leichtfuß <alguien@respiranto.de>
+# Maintainer: %MAINTAINER%
%CONTRS%
+#
+# Generated by aur-fd-scripts - https://git.respiranto.de/aur-fd-scripts.git/
+
_lang=%LANG%
_pkgname=dict-freedict-${_lang}
pkgname=${_pkgname}-bin
diff --git a/config.default.sh b/config.default.sh
new file mode 100755
index 0000000..d17b4c1
--- /dev/null
+++ b/config.default.sh
@@ -0,0 +1,75 @@
+#!/usr/bin/env bash
+#
+# config.default.sh - some configuration options.
+#
+# Move this file to config.sh and modify to your liking.
+#
+
+# The maintainer to be listed in the PKGBUILD.
+maintainer="Your Name <your@email-address.tld>"
+
+
+# Dictionaries in the VCS tree, GPL2 assumed.
+typeset -a vcs_langs
+vcs_langs=(
+ deu-eng eng-deu
+ fra-eng eng-fra
+ spa-eng eng-spa
+ )
+
+typeset -a wikdict_langs
+wikdict_langs=(
+ fra-deu deu-fra
+ )
+
+typeset -a langs
+langs=( ${vcs_langs[@]} ${wikdict_langs[@]} )
+
+
+# Long names table.
+typeset -A long
+long[fra]=French
+long[deu]=German
+long[eng]=English
+long[spa]=Spanish
+
+
+# Contributors for some specific PKGBUILDs (indexed by $lang$ext).
+typeset -A contrs
+contrs[deu-eng-bin]=\
+'# Contributor: akane <grangerspit@gmail.com> <xmpp:heiß@neko.im>'$'\n'
+contrs[eng-deu-bin]=\
+'# Contributor: akane <grangerspit@gmail.com> <xmpp:heiß@neko.im>'$'\n'
+contrs[fra-eng-bin]=\
+'# Contributor: Benjamin Vanderford <hazor_at_swrpg_dot_info>'$'\n'
+contrs[eng-fra-bin]=\
+'# Contributor: Benjamin Vanderford <hazor_at_swrpg_dot_info>'$'\n'
+
+# Licenses (indexed by $lang)
+typeset -A licenses
+for lang in ${vcs_langs[@]}
+do
+ licenses[$lang]="'GPL'"
+done
+
+for lang in ${wikdict_langs[@]}
+do
+ licenses[$lang]="'CCPL:by-sa' 'FDL'"
+done
+
+
+# prepare() functions (indexed by $lang$ext).
+typeset -A prepare
+
+# Does not work for deu-fra-bin, since the index file must stay in sync.
+prepare[deu-fra]=\
+'prepare()
+{
+ cd $_lang
+ sed -Ei \
+ -e '"'"'s/(10)(10)(100\>)(\s+\(10)(Googol.*(1|Eins) mit einem Googol Nullen)/\1^(\2^\3)\4^\5/'"'"' \
+ -e '"'"'s/(10)([1-9][0-9]*)(.*(1|Eins) mit \2 Nullen)/\1\^\2\3/'"'"' \
+ -e '"'"'s/(die Zahl 10)(60)/\1^\2/'"'"' \
+ ${_lang}.tei
+}
+'
diff --git a/make_install.sh b/make_install.sh
index 53ec43c..579586a 100755
--- a/make_install.sh
+++ b/make_install.sh
@@ -22,7 +22,7 @@
script_path="$(realpath "$0")"
script_dir="${script_path%/*}"
-. "${script_dir}/basic.sh"
+. "${script_dir}/basic.sh" || exit 1
function main
diff --git a/sample.install b/sample.install
index 7ce3ba2..f405077 100644
--- a/sample.install
+++ b/sample.install
@@ -1,3 +1,5 @@
+# Generated by aur-fd-scripts - https://git.respiranto.de/aur-fd-scripts.git/
+
basename=%LANG%
pkgname=dict-freedict-$basename%SUFFIX%
dictd_conf=/etc/dict/dictd.conf
diff --git a/src/sample.PKGBUILD b/src/sample.PKGBUILD
index b0fd9b8..ced78fd 100644
--- a/src/sample.PKGBUILD
+++ b/src/sample.PKGBUILD
@@ -1,5 +1,8 @@
-# Maintainer: Einhard Leichtfuß <alguien@respiranto.de>
+# Maintainer: %MAINTAINER%
%CONTRS%
+#
+# Generated by aur-fd-scripts - https://git.respiranto.de/aur-fd-scripts.git/
+
_lang=%LANG%
pkgname=dict-freedict-${_lang}
pkgver=%VER%
diff --git a/svn/sample.PKGBUILD b/svn/sample.PKGBUILD
index 75ece84..452640a 100644
--- a/svn/sample.PKGBUILD
+++ b/svn/sample.PKGBUILD
@@ -1,5 +1,8 @@
-# Maintainer: Einhard Leichtfuß <alguien@respiranto.de>
+# Maintainer: %MAINTAINER%
%CONTRS%
+#
+# Generated by aur-fd-scripts - https://git.respiranto.de/aur-fd-scripts.git/
+
_lang=%LANG%
_pkgname=dict-freedict-${_lang}
pkgname=${_pkgname}-svn
diff --git a/update.sh b/update.sh
index d58f45b..a032671 100755
--- a/update.sh
+++ b/update.sh
@@ -33,58 +33,7 @@
script_path="$(realpath "$0")"
script_dir="${script_path%/*}"
-. "${script_dir}/basic.sh"
-
-
-## Some configuration.
-
-# Long names table.
-typeset -A long
-long[fra]=French
-long[deu]=German
-long[eng]=English
-long[spa]=Spanish
-
-# Contributors for some specific PKGBUILDs (indexed by $lang$ext).
-typeset -A contrs
-contrs[deu-eng-bin]=\
-'# Contributor: akane <grangerspit@gmail.com> <xmpp:heiß@neko.im>'$'\n'
-contrs[eng-deu-bin]=\
-'# Contributor: akane <grangerspit@gmail.com> <xmpp:heiß@neko.im>'$'\n'
-contrs[fra-eng-bin]=\
-'# Contributor: Benjamin Vanderford <hazor_at_swrpg_dot_info>'$'\n'
-contrs[eng-fra-bin]=\
-'# Contributor: Benjamin Vanderford <hazor_at_swrpg_dot_info>'$'\n'
-
-# Licenses (indexed by $lang)
-typeset -A licenses
-for lang in ${vcs_langs[@]}
-do
- licenses[$lang]="'GPL'"
-done
-
-for lang in ${wikdict_langs[@]}
-do
- licenses[$lang]="'CCPL:by-sa' 'FDL'"
-done
-
-# prepare() functions (indexed by $lang$ext).
-typeset -A prepare
-
-# Does not work for deu-fra-bin, since the index file must stay in sync.
-prepare[deu-fra]=\
-'prepare()
-{
- cd $_lang
- sed -Ei \
- -e '"'"'s/(10)(10)(100\>)(\s+\(10)(Googol.*(1|Eins) mit einem Googol Nullen)/\1^(\2^\3)\4^\5/'"'"' \
- -e '"'"'s/(10)([1-9][0-9]*)(.*(1|Eins) mit \2 Nullen)/\1\^\2\3/'"'"' \
- -e '"'"'s/(die Zahl 10)(60)/\1^\2/'"'"' \
- ${_lang}.tei
-}
-'
-
-## End configuration
+. "${script_dir}/basic.sh" || exit 1
function main
@@ -140,6 +89,7 @@ function update
input "${script_dir}/${type}/sample.PKGBUILD"
+ replace '%MAINTAINER%' "$maintainer"
replace '%LANG%' "$lang"
replace '%LANG_A%' "$lang_a"
replace '%LANG_B%' "$lang_b"