Compare commits
1 Commits
main
...
licensing_
Author | SHA1 | Date | |
---|---|---|---|
cc8e8c28e4
|
29
apply_license_to_vb.sh
Executable file
29
apply_license_to_vb.sh
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Chemin vers le fichier contenant le header
|
||||||
|
HEADER_FILE="license_header.vb.txt"
|
||||||
|
|
||||||
|
# Vérifie si le fichier contenant le header existe
|
||||||
|
if [[ ! -f "$HEADER_FILE" ]]; then
|
||||||
|
echo "Le fichier $HEADER_FILE n'existe pas. Veuillez le créer avant d'exécuter ce script."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Lit le contenu du header
|
||||||
|
HEADER_CONTENT=$(<"$HEADER_FILE")
|
||||||
|
|
||||||
|
# Ajoute le header à tous les fichiers .vb
|
||||||
|
find . -type f -name "*.vb" | while read -r FILE; do
|
||||||
|
echo "Ajout du header dans $FILE..."
|
||||||
|
|
||||||
|
# Vérifie si le fichier commence par un BOM
|
||||||
|
if head -c 3 "$FILE" | grep -q $'\xef\xbb\xbf'; then
|
||||||
|
# Conserve le BOM et insère le header juste après
|
||||||
|
(head -c 3 "$FILE"; echo "$HEADER_CONTENT"; tail -c +4 "$FILE") > "$FILE.tmp" && mv "$FILE.tmp" "$FILE"
|
||||||
|
else
|
||||||
|
# Insère le header au début du fichier (pas de BOM)
|
||||||
|
(echo "$HEADER_CONTENT"; cat "$FILE") > "$FILE.tmp" && mv "$FILE.tmp" "$FILE"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Ajout du header terminé."
|
39
apply_license_to_xml.sh
Executable file
39
apply_license_to_xml.sh
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Chemin vers le fichier contenant le header de licence
|
||||||
|
HEADER_FILE="license_header.xml.txt"
|
||||||
|
|
||||||
|
# Vérifie si le fichier contenant le header existe
|
||||||
|
if [[ ! -f "$HEADER_FILE" ]]; then
|
||||||
|
echo "Le fichier $HEADER_FILE n'existe pas. Veuillez le créer avant d'exécuter ce script."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Lit le contenu du header
|
||||||
|
HEADER_CONTENT=$(<"$HEADER_FILE")
|
||||||
|
|
||||||
|
# Ajoute le header après la ligne <?xml ... ?> dans tous les fichiers .xsd, .config et .xml
|
||||||
|
#find . -type f \( -name "*.xsd" -o -name "*.config" -o -name "*.xml" \) | while read -r FILE; do
|
||||||
|
find . -type f \( -name "*.vbproj" \) | while read -r FILE; do
|
||||||
|
echo "Ajout du header dans $FILE..."
|
||||||
|
|
||||||
|
# Vérifie si le fichier commence par un BOM
|
||||||
|
if head -c 3 "$FILE" | grep -q $'\xef\xbb\xbf'; then
|
||||||
|
# Le fichier contient un BOM
|
||||||
|
echo "Fichier avec BOM détecté : $FILE"
|
||||||
|
tail -c +4 "$FILE" > "$FILE.tmp" # Supprime temporairement le BOM
|
||||||
|
mv "$FILE.tmp" "$FILE"
|
||||||
|
BOM_PRESENT=true
|
||||||
|
else
|
||||||
|
BOM_PRESENT=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Insère le header après la ligne <?xml ... ?>
|
||||||
|
awk -v header="$HEADER_CONTENT" -v bom="$BOM_PRESENT" '
|
||||||
|
BEGIN { if (bom == "true") printf "\xef\xbb\xbf" } # Réinsère le BOM si nécessaire
|
||||||
|
/^<\?xml/ { print; print header; next } # Insère le header après <?xml ... ?>
|
||||||
|
{ print }
|
||||||
|
' "$FILE" > "$FILE.tmp" && mv "$FILE.tmp" "$FILE"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Ajout du header terminé."
|
14
license_header.vb.txt
Normal file
14
license_header.vb.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
' Copyright (C) 2025 P4pillon.org
|
||||||
|
'
|
||||||
|
' This program is free software: you can redistribute it and/or modify
|
||||||
|
' it under the terms of the GNU Affero General Public License as
|
||||||
|
' published by the Free Software Foundation, either version 3 of the
|
||||||
|
' License, or (at your option) any later version.
|
||||||
|
'
|
||||||
|
' This program is distributed in the hope that it will be useful,
|
||||||
|
' but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
' GNU Affero General Public License for more details.
|
||||||
|
'
|
||||||
|
' You should have received a copy of the GNU Affero General Public License
|
||||||
|
' along with this program. If not, see <https://www.gnu.org/licenses/>.
|
16
license_header.xml.txt
Normal file
16
license_header.xml.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!--
|
||||||
|
Copyright (C) 2025 P4pillon.org
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
-->
|
Reference in New Issue
Block a user