diff options
author | Einhard Leichtfuß <alguien@respiranto.de> | 2018-03-30 22:08:42 +0200 |
---|---|---|
committer | Einhard Leichtfuß <alguien@respiranto.de> | 2018-03-30 22:08:42 +0200 |
commit | 2a7eb7221b85af3f2c5141c3918ff1959566f55a (patch) | |
tree | fd6725c155ab0e8ef8e6ef7383d1ab2d66ca359c /update.sh | |
parent | 9d45fe6b329cbae295ed83d90dd20c5fc3e70717 (diff) |
Split some functionality off update.sh
Such that it may be used by the to be bettered make_install.sh.
In particular, the latter is supposed to work for both non-vcs source
and binary packages.
Also add a main() method to update.sh.
Diffstat (limited to 'update.sh')
-rwxr-xr-x | update.sh | 48 |
1 files changed, 8 insertions, 40 deletions
@@ -46,39 +46,16 @@ prepare[deu-fra-bin]=\ } ' -# $1: string to replace: regular expression -# $2: string to replace with: sed replacement string -function replace -{ - sed -i "s/${1}/${2}/g" "$tmp" -} +. basic.sh -# $1 line to replace: regular expression -# $2 text to replace with: (newline terminated) sed replacement string -# $3 removal type: (rm-plus-one|normal) -function replace_line +function main { - if test -n "$2" - then - cat <(sed "/${1}/,\$ d" < "$tmp") \ - <(echo -n "$2") \ - <(sed "0,/${1}/ d" < "$tmp") \ - > "$tmp_" - mv "$tmp_" "$tmp" - else - if [[ "$3" == rm-plus-one ]] - then - sed -i "/${1}/,+1 d" "$tmp" - else - sed -i "/${1}/ d" "$tmp" - fi - fi -} + curl -sO http://freedict.org/freedict-database.json -# $1 line to delete: regular expression -function delete_line -{ - sed -i "/${1}/ d" "$tmp" + init + handle_all src '' src "$@" + handle_all bin -bin dictd "$@" + cleanup } function update @@ -90,10 +67,6 @@ function update checksum="$(wget -qO - "$url" | sha512sum | sed -E 's/\s*-$//')" - tmp_d="$(mktemp -d)" - tmp="$tmp_d/a" - tmp_="$tmp_d/b" - cp ../sample.PKGBUILD "$tmp" replace '%LANG%' "$lang" @@ -114,8 +87,6 @@ function update mv "$tmp" PKGBUILD makepkg --printsrcinfo > .SRCINFO - - rm -r "$tmp_d" } # $1 type: (src|bin) @@ -168,7 +139,4 @@ function handle_all } -curl -sO http://freedict.org/freedict-database.json - -handle_all src '' src "$@" -handle_all bin -bin dictd "$@" +main "$@" |