aboutsummaryrefslogtreecommitdiff
path: root/make_install.sh
diff options
context:
space:
mode:
authorEinhard Leichtfuß <alguien@respiranto.de>2018-03-31 00:58:43 +0200
committerEinhard Leichtfuß <alguien@respiranto.de>2018-03-31 00:58:43 +0200
commite3bfbb28e8cd30c71d1d1cce0649ed7d448312f0 (patch)
tree73d7516525bc515b5935eca34135cb03b050353b /make_install.sh
parentbbc3e4cfa5c02ad3ff8dcd3b7a95e568ac434c6f (diff)
Add support for dict-freedict-* in make_install
Furthermore: - Move $langs[] to basic.sh in order to be able to use it in make_install. - Add -f to rm in cleanup() in order to prevent unforeseen errors, that don't matter.
Diffstat (limited to 'make_install.sh')
-rwxr-xr-xmake_install.sh58
1 files changed, 45 insertions, 13 deletions
diff --git a/make_install.sh b/make_install.sh
index a24837f..88e35dd 100755
--- a/make_install.sh
+++ b/make_install.sh
@@ -1,15 +1,47 @@
#!/bin/bash
-if [ "$#" -lt 1 ]
-then
- echo "Usage: $0 xy-zw [base_dir]" >&2
- exit 1
-elif [ "$#" -gt 1 ]
-then
- cd "$2" || exit 1
-fi
-
-lang=$1
-pkgname=dict-freedict-${lang}
-
-sed "s/%LANG%/${lang}/g" sample.install > ${pkgname}/${pkgname}.install
+. basic.sh
+
+function main
+{
+ if [ "$#" -lt 2 ]
+ then
+ echo "Usage: $0 <base_dir> <type> (<xy>-<zw>|-a)" >&2
+ exit 1
+ elif [ "$#" -gt 2 ]
+ then
+ cd "${1}/${2}" || exit 1
+ fi
+
+ if [[ "$1" == src ]]
+ then
+ ext=
+ else
+ ext="-${2}"
+ fi
+
+ init
+
+ if [[ "$3" == "-a" ]]
+ then
+ for lang in ${langs[@]}
+ do
+ make_install
+ done
+ else
+ lang=$3
+ make_install
+ fi
+}
+
+function make_install
+{
+ pkgname=dict-freedict-${lang}${ext}
+
+ cp ../sample.install "$tmp"
+ replace "%LANG%" "$lang"
+ replace "%SUFFIX%" "$ext"
+ mv "$tmp" ${pkgname}/${pkgname}.install
+}
+
+main "$@"