From 915faab9c074a0a30b8321c3836d0b35f475e94d Mon Sep 17 00:00:00 2001 From: Einhard Leichtfuß Date: Fri, 29 Apr 2022 14:58:55 +0200 Subject: Use proper .bash suffix --- make_install.bash | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 make_install.bash (limited to 'make_install.bash') 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 . +# + +script_path="$(realpath "$0")" +script_dir="${script_path%/*}" +. "${script_dir}/basic.bash" || exit 1 + + +function main +{ + if [ "$#" -lt 2 ] + then + echo "Usage: $0 (-|-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 == / +# +function make_install +{ + pkgname=dict-freedict-${lang}${ext} + + input "${script_dir}/sample.install" + replace "%LANG%" "$lang" + replace "%SUFFIX%" "$ext" + write "${lang}/${pkgname}.install" +} + + +main "$@" -- cgit v1.2.3