diff options
Diffstat (limited to 'common')
-rwxr-xr-x | common/files/init | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/common/files/init b/common/files/init index b9b4f80..dfdf8c6 100755 --- a/common/files/init +++ b/common/files/init @@ -68,10 +68,51 @@ prompt CURRENT_DATE "The stylized version of the current date" "$(date +'%b %Y') prompt YEAR "The year the work on this has begun (for copyright reasons)" "$(date +'%Y')" # LICENSE.spdx data (source: https://github.com/david-a-wheeler/spdx-tutorial) +if [ -e ./lpm.toml ]; then + # Use a different default license in latex projects. + init_default_license="CC-BY-SA-4.0" +else + init_default_license="GPL-3.0-or-later" +fi +prompt SPDX_LICENSE_IDENTIFIER "THE SPDX identifer of your choosen license" "$init_default_license" prompt APPLICATION_ORIGINATOR "The person or organization from whom the package originally came" "$AUTHOR_NAME" prompt APPLICATION_HOME_PAGE "The package's home page URL" "https://$REMOTE/$OWNER/$REPOSITORY" -echo "$DESCRIPTION" > .git/description +echo "Downloading license .." +case "$SPDX_LICENSE_IDENTIFIER" in +"AGPL-3.0-or-later") + default_license_url="https://www.gnu.org/licenses/agpl-3.0.txt" + curl "$default_license_url" >COPYING + ;; +"GPL-3.0-or-later") + default_license_url="https://www.gnu.org/licenses/gpl-3.0.txt" + curl "$default_license_url" >COPYING + ;; +"LGPL-3.0-or-later") + default_license_url="https://www.gnu.org/licenses/lgpl+gpl-3.0.txt" + curl "https://www.gnu.org/licenses/gpl-3.0.txt" >COPYING + curl "https://www.gnu.org/licenses/lgpl-3.0-standalone.html" >COPYING.LESSER + ;; + +"Apache-2.0") + default_license_url="https://www.apache.org/licenses/LICENSE-2.0.txt" + curl "$default_license_url" >LICENSE + ;; + +"CC-BY-SA-4.0") + default_license_url="https://creativecommons.org/licenses/by-sa/4.0/legalcode.txt" + curl "$default_license_url" >LICENSE + ;; + +*) + default_license_url="file:///dev/null" + echo " -> No license found for your identifier: '$SPDX_LICENSE_IDENTIFIER'" + ;; +esac + +prompt LICENSE_URL "The url of the license" "$default_license_url" "dont_ask" + +echo "$DESCRIPTION" >.git/description while read -r var; do var_name="${var%=*}" |