diff options
Diffstat (limited to 'make_install.bash')
-rwxr-xr-x | make_install.bash | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/make_install.bash b/make_install.bash new file mode 100755 index 0000000..1df6acb --- /dev/null +++ b/make_install.bash @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +# +# make_install.bash - script to create the .install files +# +# Copyright 2018,2022 Einhard Leichtfuß +# +# This file is part of aur-fd-scripts +# +# aur-fd-scripts is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# aur-fd-scripts is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with aur-fd-scripts. If not, see <https://www.gnu.org/licenses/>. +# + +script_path="$(realpath "$0")" +script_dir="${script_path%/*}" +. "${script_dir}/basic.bash" || exit 1 + + +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 [[ "$2" == 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 +} + + +# Create the install file. +# +# requires: $lang, $ext to be set; +# $PWD == <base directory>/<type> +# +function make_install +{ + pkgname=dict-freedict-${lang}${ext} + + input "${script_dir}/sample.install" + replace "%LANG%" "$lang" + replace "%SUFFIX%" "$ext" + write "${lang}/${pkgname}.install" +} + + +main "$@" |