From 5f885537e29ecd6b63b50f8374799c8604e486be Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 22 Jul 2017 18:49:50 -0400 Subject: scripts/update-license-notice.sh: Rewrite in native SCL (works now) --- (limited to 'scripts') diff --git a/scripts/update-license-notice.sh b/scripts/update-license-notice.sh index 80b2ff8..e139b02 100755 --- a/scripts/update-license-notice.sh +++ b/scripts/update-license-notice.sh @@ -18,7 +18,9 @@ set -eu -cat >license-notice.txt <<-'EOF' +LF=' +' +NEW_NOTICE="$(cat <<-'EOF' # This file is part of the ProteanOS Archive Manager. # # The ProteanOS Archive Manager is free software: you can redistribute @@ -35,20 +37,26 @@ cat >license-notice.txt <<-'EOF' # along with the ProteanOS Archive Manager. If not, see # . EOF + )" if [ ${#} -eq 0 ]; then printf 'Usage: %s ...\n' "${0}" >&2 fi -gnu_lic_url='' for file in "${@}"; do - sed ' - /This program is free software:/,/'"${gnu_lic_url}"'/{ - d - r license-notice.txt - } - ' "${file}" >"${file}~" - mv "${file}~" "${file}" + text='' + while IFS= read -r line; do + case "${line}" in '# This program is free software:'*) + while IFS= read -r notice; do + case "${notice}" in + *'.') + text="${text}${NEW_NOTICE}${LF}" + break; + ;; + esac + done + ;; esac + text="${text}${line}${LF}" + done <"${file}" + printf '%s' "${text}" >"${file}" done - -rm -f license-notice.txt -- cgit v0.9.1