diff options
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 "$@" |