You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

178 lines
5.4 KiB

#! /bin/sh
#
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright 2022 Yzena Tech
#
# Licensed under the Yzena User License, Version 0.1 (the "Yzena User License"
# or "YUL"). You may not use this file except in compliance with the Yzena
# User License.
#
# You may obtain a copy of the Yzena User License at
#
# https://yzena.com/yzena-user-license/
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Yzena Network License is distributed under the
# following disclaimer:
#
# As far as the law allows, this software comes as is, without any
# warranty or condition, and no contributor will be liable to anyone for
# any damages related to this software or this license, under any kind of
# legal claim.
#
# ****** END LICENSE BLOCK ******
#
script="$0"
scriptdir=$(dirname "$script")
script=$(basename "$script")
version="0.1"
cd "$scriptdir"
parts=$(ls parts/licenses/)
faq_parts=$(ls parts/faqs/)
links="
ycul|https://yzena.com/yzena-copyleft-user-license/
ynl|https://yzena.com/yzena-network-license/
ynul|https://yzena.com/yzena-network-user-license/
yvl|https://yzena.com/yzena-viral-license/
yvul|https://yzena.com/yzena-viral-user-license/
compatibility|\#compatibility
distribution|\#distribution
notices|\#notices
credits|\#credits
trademarks|\#trademarks
litigation|\#litigation
no_liability|\#no-liability
non-interference|\#non-interference
respecting_user_choice|\#respecting-user-choice"
faq_links="
copyleft|https://writing.kemitchell.com/2018/10/24/How-to-Speak-Copyleft.html
viral|https://en.wikipedia.org/wiki/Viral_license
gpl|https://www.gnu.org/licenses/gpl-3.0.html
agpl|https://www.gnu.org/licenses/agpl-3.0.html
gavinhoward|https://gavinhoward.com/
yzena|https://yzena.com/
boml|https://blueoakcouncil.org/license/1.0.0
license_notices|https://writing.kemitchell.com/2020/12/27/War-on-License-Notices.html
chalkeaters|https://writing.kemitchell.com/2021/01/31/Chalkeaters-License.html
mit_deprecation|https://writing.kemitchell.com/2019/03/09/Deprecation-Notice.html
boml_faq|https://blueoakcouncil.org/license-faq
purpose|./{l}.md\#purpose
source_code|./{l}.md\#source-code
this_software|./{l}.md\#this-software
combined_software|./{l}.md\#combined-software
application|./{l}.md\#application
user_agency|\#user-agency
compatibility|./{l}.md\#compatibility
distribution|./{l}.md\#distribution
notices|./{l}.md\#notices
credits|./{l}.md\#credits
trademarks|./{l}.md\#trademarks
litigation|./{l}.md\#litigation
non-interference|./{l}.md\#non-interference
respecting_user_choice|./{l}.md\#respecting-user-choice
excuse|./{l}.md\#excuse
reliability|./{l}.md\#reliability
no_duty|{l}.md\#no-duty
no_liability|{l}.md\#no-liability
no_relationship|{l}.md\#no-relationship
markdown|https://www.markdownguide.org/getting-started
apache_license|https://www.apache.org/licenses/LICENSE-2.0.html
sunset|https://github.com/copyleft-next/copyleft-next/blob/master/Releases/copyleft-next-0.3.1\#L89-L93
ctea|https://en.wikipedia.org/wiki/Copyright_Term_Extension_Act
nullification|https://github.com/copyleft-next/copyleft-next/blob/master/Releases/copyleft-next-0.3.1\#L81-L87
copilot|https://copilot.github.com/
fair_use|https://valohai.com/blog/copyright-laws-and-machine-learning/\#fairusedoctrineintheus
lto|https://en.wikipedia.org/wiki/Interprocedural_optimization\#WPO_and_LTO
inlining|https://en.wikipedia.org/wiki/Inline_expansion
algorithm_transform|https://cacm.acm.org/magazines/2020/2/242347-optimizations-in-c-compilers/fulltext\#body-6
four_freedoms|https://www.gnu.org/philosophy/free-sw.en.html
hash_functions|https://en.wikipedia.org/wiki/Hash_function
static_analysis|https://en.wikipedia.org/wiki/Static_program_analysis
spdx|https://spdx.org/licenses/
ypl|https://spdx.org/licenses/YPL-1.0.html
professionalism|https://gavinhoward.com/2020/08/the-software-industry-is-broken/\#embracing-professionalism
of_regrets|https://laanwj.github.io/2023/02/06/regrets.html
indemnity|https://news.ycombinator.com/item?id=34686718
lawsuit|https://news.ycombinator.com/item?id=34685029
relationship|https://news.ycombinator.com/item?id=34687437
seventh_law|http://www.loper-os.org/?p=278"
for f in YOL YCL YCUL YNL YNUL YVL YVUL; do
file="$f/$f.md"
faq="$f/FAQ.md"
case $f in
# Can't do the User clauses on YOL because such software can be
# relicensed.
YOL) LICENSE="Yzena Open License" ;;
YCL) LICENSE="Yzena Copyleft License" ;;
YCUL) LICENSE="Yzena Copyleft User License" ;;
YNL) LICENSE="Yzena Network License" ;;
YNUL) LICENSE="Yzena Network User License" ;;
YVL) LICENSE="Yzena Viral License" ;;
YVUL) LICENSE="Yzena Viral User License" ;;
esac
rm -f "$file"
rm -f "$faq"
cp "$file.in" "$file"
cp "$faq.in" "$faq"
sed -i -e "s/{{ version }}/Version $version/g" "$file"
for p in $parts; do
b=$(basename "$p" ".md")
sed -i -e "/{{ $b }}/r parts/licenses/$p" "$file"
sed -i -e "/{{ $b }}/d" "$file"
done
for p in $faq_parts; do
b=$(basename "$p" ".md")
contents=$(cat "parts/faqs/$p")
sed -i -e "/{{ $b }}/r parts/faqs/$p" "$faq"
sed -i -e "/{{ $b }}/{N;s/\n//;}" "$faq"
sed -i -e "s/{{ $b }}//g" "$faq"
done
for l in $links; do
label="${l%%|*}"
ref="${l##*|}"
sed -i "s!{{ ref-$label }}!\[${version}-${label}\]: $ref!g" "$file"
done
for l in $faq_links; do
label="${l%%|*}"
ref="${l##*|}"
sed -i "s!{{ ref-$label }}!\[faq-${label}\]: $ref!g" "$faq"
done
sed -i "s/{v}/$version/g" "$file"
sed -i "s/{v}/$version/g" "$faq"
sed -i "s/{l}/$f/g" "$faq"
sed -i "s/{{ LICENSE }}/$LICENSE/g" "$faq"
done