diff options
author | Jesusaves <cpntb1@ymail.com> | 2022-10-23 23:45:19 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2022-10-23 23:45:19 -0300 |
commit | c2ccb14ffff0e45398365e19dfd2874307ddb943 (patch) | |
tree | 976eaea586fb8f1ee0ab8cae67c69071aed8b952 /licensecheck | |
download | tools-c2ccb14ffff0e45398365e19dfd2874307ddb943.tar.gz tools-c2ccb14ffff0e45398365e19dfd2874307ddb943.tar.bz2 tools-c2ccb14ffff0e45398365e19dfd2874307ddb943.tar.xz tools-c2ccb14ffff0e45398365e19dfd2874307ddb943.zip |
Initial commit
Diffstat (limited to 'licensecheck')
-rwxr-xr-x | licensecheck/checkfile.sh | 12 | ||||
-rwxr-xr-x | licensecheck/clientdata.sh | 9 | ||||
-rwxr-xr-x | licensecheck/serverdata.py | 71 |
3 files changed, 92 insertions, 0 deletions
diff --git a/licensecheck/checkfile.sh b/licensecheck/checkfile.sh new file mode 100755 index 0000000..38835d5 --- /dev/null +++ b/licensecheck/checkfile.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +export name="$3" +export name=${name##../../clientdata/} + +grep "$name" $1 >/dev/null +if [ "$?" != 0 ]; then + grep "$name " $2 >/dev/null + if [ "$?" != 0 ]; then + echo "Missing license for $name" + fi +fi diff --git a/licensecheck/clientdata.sh b/licensecheck/clientdata.sh new file mode 100755 index 0000000..cd63426 --- /dev/null +++ b/licensecheck/clientdata.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +export DIR="../../clientdata" + +find -H $DIR -type f -name "*.png" -exec ./checkfile.sh $DIR/LICENSE $DIR/ART_LICENSE {} \; +find -H $DIR/sfx -type f -name "*.ogg" -exec ./checkfile.sh $DIR/LICENSE $DIR/ART_LICENSE {} \; +find -H $DIR -type f -name "*.tmx" -exec ./checkfile.sh $DIR/LICENSE $DIR/ART_LICENSE {} \; +find -H $DIR -type f -name "*.jpg" -exec ./checkfile.sh $DIR/LICENSE $DIR/ART_LICENSE {} \; + diff --git a/licensecheck/serverdata.py b/licensecheck/serverdata.py new file mode 100755 index 0000000..8a731a4 --- /dev/null +++ b/licensecheck/serverdata.py @@ -0,0 +1,71 @@ +#! /usr/bin/env python2.7 +# -*- coding: utf8 -*- +# +# Copyright (C) 2018 TMW-2 +# Author: Jesusalva + +# Bad command: +# ls --recursive --hyperlink=always --format=single-column ../../serverdata/npc/|grep txt + +# Initialize stuff +import subprocess +import sys +import os +erp=[] + +# Clear previous NPC list +try: + subprocess.call("rm npcs.txt", shell=True) +except: + pass + +# Determine correct path +PATH="../../serverdata/npc/" +if len(sys.argv) == 2: + PATH=sys.argv[1] + +# Generate NPC list +subprocess.call("find "+PATH+" txt > npcs.txt", shell=True) +npcs=open("npcs.txt", "r") + +# Begin +print("Checking license info for NPCs") +print("Source is at: "+PATH) + +for mpa in npcs: + mp=mpa.replace('\n','') + # Skip mapflags + if "mapflag" in mp: + continue + # Skip bad files + if not '.txt' in mp: + continue + # Skip certain folders + if "/dev/" in mp or "/00000SAVE/" in mp or "/test/" in mp: + continue + + a=open(mp, 'r') + #print("Verify %s" % mp) + ok=False + for line in a: + if 'tmw2 script' in line.lower() or 'tmw-2 script' in line.lower() or 'tmw 2 script' in line.lower() or 'tmw2/lof script' in line.lower() or 'This file is generated automatically' in line or 'author' in line.lower() or 'tmw2 function' in line.lower() or 'tmw-2 function' in line.lower() or 'tmw 2 function' in line.lower(): + ok=True + break + + a.close() + if not ok: + erp.append(mp) + +npcs.close() +if len(erp) > 0: + print("-----------------------------------------------------------------------") + +for i in sorted(erp): + print(i) + +print("-----------------------------------------------------------------------") +print("Serverdata license check result") +print("Errors: %d" % (len(erp))) +if len(erp): + os.exit(1) + |