Add script to collect copyrights for deb creation.

pull/303/head
Fredrik Öhrström 2021-06-26 16:30:24 +02:00
rodzic e8b60c6bd5
commit 8b258304ee
17 zmienionych plików z 90 dodań i 126 usunięć

Wyświetl plik

@ -219,16 +219,33 @@ wmbusmeters_$(DEBVERSION)_$(DEBARCH).deb:
@rm -rf $(BUILD)/debian/wmbusmeters
@mkdir -p $(BUILD)/debian/wmbusmeters/DEBIAN
@./install.sh $(BUILD)/wmbusmeters $(BUILD)/debian/wmbusmeters --no-adduser
@rm -f $(BUILD)/debian/wmbusmeters/DEBIAN/control
# Remove the conf files, they are to be installed by postinst.
@rm $(BUILD)/debian/wmbusmeters/etc/wmbusmeters.conf
@rmdir $(BUILD)/debian/wmbusmeters/etc/wmbusmetersd
# Build the control file
@echo "Package: wmbusmeters" >> $(BUILD)/debian/wmbusmeters/DEBIAN/control
@echo "Version: $(DEBVERSION)" >> $(BUILD)/debian/wmbusmeters/DEBIAN/control
@echo "Maintainer: Fredrik Öhrström" >> $(BUILD)/debian/wmbusmeters/DEBIAN/control
@echo "Maintainer: Fredrik Öhrström <oehrstroem@gmail.com>" >> $(BUILD)/debian/wmbusmeters/DEBIAN/control
@echo "Architecture: $(DEBARCH)" >> $(BUILD)/debian/wmbusmeters/DEBIAN/control
@echo "Installed-Size: 1" >> $(BUILD)/debian/wmbusmeters/DEBIAN/control
@echo "Depends: libc6 (>= 2.27)" >> $(BUILD)/debian/wmbusmeters/DEBIAN/control
@echo "Section: kernel" >> $(BUILD)/debian/wmbusmeters/DEBIAN/control
@echo "Priority: optional" >> $(BUILD)/debian/wmbusmeters/DEBIAN/control
@echo "Homepage: https://github.com/weetmuts/wmbusmeters" >> $(BUILD)/debian/wmbusmeters/DEBIAN/control
@echo "Description: A tool to read wireless mbus telegrams from utility meters." >> $(BUILD)/debian/wmbusmeters/DEBIAN/control
@mkdir -p $(BUILD)/debian/wmbusmeters/usr/share/doc/wmbusmeters
# Install the changelog
@cp deb/changelog $(BUILD)/debian/wmbusmeters/usr/share/doc/wmbusmeters/changelog.Debian
@gzip -v9 $(BUILD)/debian/wmbusmeters/usr/share/doc/wmbusmeters/changelog.Debian
# Collect copyright information
@./deb/collect_copyrights.sh
@cp /tmp/copyright $(BUILD)/debian/wmbusmeters/usr/share/doc/wmbusmeters/copyright
# Install the install/remove scripts.
@for x in preinst postinst prerm postrm ; do \
cp scripts/$$x $(BUILD)/debian/wmbusmeters/DEBIAN/ ; \
cp deb/$$x $(BUILD)/debian/wmbusmeters/DEBIAN/ ; \
chmod 555 $(BUILD)/debian/wmbusmeters/DEBIAN/$$x ; \
done
# Package the deb
@(cd $(BUILD)/debian; dpkg-deb --build wmbusmeters .)
@mv $(BUILD)/debian/wmbusmeters_$(DEBVERSION)_$(DEBARCH).deb .
@echo Built package $@

Wyświetl plik

@ -0,0 +1,52 @@
#!/bin/bash
rm -f /tmp/copyright
cat > /tmp/copyright <<EOF
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: wmbusmeters
Source: https://github.com/weetmuts/wmbusmeters
Upstream-Contact: Fredrik Öhrström <oehrstroem@gmail.com>
Files: *
Copyright: 2017-2021 Fredrik Öhrström <oehrstroem@gmail.com>
License: GPL-3+
EOF
SOURCES=$(find src -type f | sort)
for f in $SOURCES
do
cat $f | grep "Copyright (C)" | sed 's/.*Copyright (C) *//g' > /tmp/authors
cat /tmp/authors | grep -v Öhrström > /tmp/other_authors
cops=$(cat /tmp/authors | tr '\n' '|' | sed -z 's/|$//g' | sed 's/|/,\n /g')
license="GPL-3+"
if grep -q -i "public domain" $f
then
license="Public Domain"
fi
if [ -s /tmp/other_authors ]
then
{
echo "Files: $f"
echo "Copyright: $cops"
echo "License: $license"
echo ""
} >> /tmp/copyright
fi
done
cat >> /tmp/copyright <<EOF
License: GPL-3+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
On Debian systems, the complete text of the GNU General Public License
version 3 can be found in file "/usr/share/common-licenses/GPL-3".
Licenase: Public Domain
The authors, and therefore would be copyright holders, have as much
as possible relinguished their copyright to the public domain.
EOF

Wyświetl plik

@ -64,7 +64,7 @@ echo "binaries: installed $ROOT/usr/bin/wmbusmeters and $ROOT/usr/sbin/wmbusmete
rm -f "$ROOT"/usr/share/man/man1/wmbusmeters.1.gz
mkdir -p "$ROOT"/usr/share/man/man1
gzip -c wmbusmeters.1 > "$ROOT"/usr/share/man/man1/wmbusmeters.1.gz
gzip -v9 -c wmbusmeters.1 > "$ROOT"/usr/share/man/man1/wmbusmeters.1.gz
echo "man page: installed $ROOT/usr/share/man/man1/wmbusmeters.1.gz"

Wyświetl plik

@ -1,5 +1,6 @@
// Source from https://github.com/kokke/tiny-AES128-C
// Public Domain / CC0 / Unlicense
// Copyright (C) kokke
/*
This is an implementation of the AES algorithm, specifically ECB and CBC mode.

Wyświetl plik

@ -1,5 +1,6 @@
// Source from https://github.com/kokke/tiny-AES128-C
// Public Domain / CC0 / Unlicense
// Copyright (C) kokke
#ifndef _AES_H_
#define _AES_H_

Wyświetl plik

@ -1,114 +0,0 @@
/* CRC experiments. Some day, the crc checks will actually work. */
#include<stdio.h>
#include<stdint.h>
typedef unsigned char uchar;
#define CRC16_DNP 0x3D65
uint16_t crc16_dnp_per_byte(uint16_t crc, uchar b)
{
unsigned char i;
for (i = 0; i < 8; i++) {
if (((crc & 0x8000) >> 8) ^ (b & 0x80)){
crc = (crc << 1) ^ CRC16_DNP;
} else {
crc = (crc << 1);
}
b <<= 1;
}
return crc;
}
uint16_t crc16_dnp(uchar *data, size_t len)
{
uint16_t crc = 0x0000;
for (size_t i=0; i<len; ++i) {
crc = crc16_dnp_per_byte(crc, data[i]);
}
return (~crc);
}
int main() {
unsigned char data[4];
data[0] = 0x01;
data[1] = 0xfd;
data[2] = 0x1f;
data[3] = 0x01;
// ./reveng/reveng -m CRC-16/EN-13757 -c 01FD1F01
// cc22
int crc = crc16_dnp(data, 4);
int crc_msb = (crc >> 8)&0xff;
int crc_lsb = crc&0xff;
printf("%02x %02x\n", crc_msb, crc_lsb);
if (crc != 0xcc22) {
printf("ERROR!\n");
}
data[3] = 0x00;
// ./reveng/reveng -m CRC-16/EN-13757 -c 01FD1F00
// f147
crc = crc16_dnp(data, 4);
crc_msb = (crc >> 8)&0xff;
crc_lsb = crc&0xff;
printf("%02x %02x\n", crc_msb, crc_lsb);
if (crc != 0xf147) {
printf("ERROR!\n");
}
uchar block[10];
block[0]=0xEE;
block[1]=0x44;
block[2]=0x9A;
block[3]=0xCE;
block[4]=0x01;
block[5]=0x00;
block[6]=0x00;
block[7]=0x80;
block[8]=0x23;
block[9]=0x07;
// ./reveng/reveng -m CRC-16/EN-13757 -c EE449ACE010000802307
// aabc
crc = crc16_dnp(block, 10);
crc_msb = (crc >> 8)&0xff;
crc_lsb = crc&0xff;
printf("%02x %02x\n", crc_msb, crc_lsb);
if (crc != 0xaabc) {
printf("ERROR!\n");
}
// width=16 poly=0x3d65 init=0x0000 refin=false refout=false xorout=0xffff check=0xc2b7 residue=0xa366 name="CRC-16/EN-13757"
block[0]='1';
block[1]='2';
block[2]='3';
block[3]='4';
block[4]='5';
block[5]='6';
block[6]='7';
block[7]='8';
block[8]='9';
crc = crc16_dnp(block, 9);
crc_msb = (crc >> 8)&0xff;
crc_lsb = crc&0xff;
printf("%02x %02x\n", crc_msb, crc_lsb);
if (crc != 0xc2b7) {
printf("ERROR!\n");
}
}

Wyświetl plik

@ -1,6 +1,6 @@
/*
Copyright (C) 2019 Jacek Tomasiak
2021 Vincent Privat
Copyright (C) 2021 Vincent Privat
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -1,6 +1,6 @@
/*
Copyright (C) 2019 Jacek Tomasiak
2021 Vincent Privat
Copyright (C) 2021 Vincent Privat
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -1,6 +1,6 @@
/*
Copyright (C) 2019-2020 Fredrik Öhrström
2021 Vincent Privat
Copyright (C) 2021 Vincent Privat
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -1,7 +1,7 @@
/*
Copyright (C) 2019 Jacek Tomasiak
2020 Fredrik Öhrström
2021 Vincent Privat
Copyright (C) 2020 Fredrik Öhrström
Copyright (C) 2021 Vincent Privat
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -1,7 +1,7 @@
/*
Copyright (C) 2018-2020 Fredrik Öhrström
2020 Eric Bus
2020 Nikodem Jędrzejczak
Copyright (C) 2020 Eric Bus
Copyright (C) 2020 Nikodem Jędrzejczak
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -7,6 +7,10 @@
//
// This is free and unencumbered software released into the public domain - June 2013 waterjuice.org
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
Copyright (C) Tom St Denis <tomstdenis@gmail.com>
Copyright (C) WaterJuice <waterjuice.org>
*/
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// IMPORTS

Wyświetl plik

@ -7,7 +7,10 @@
//
// This is free and unencumbered software released into the public domain - June 2013 waterjuice.org
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
Copyright (C) Tom St Denis <tomstdenis@gmail.com>
Copyright (C) WaterJuice <waterjuice.org>
*/
#pragma once
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////