Hi Juanito,
Okay, as you've responded I will paste this message here, it probably
reads a little aggressively. But rather than clean it up I'll just say
that it's a picture of how frustrating the process is. The question at
the end still applies though, have I missed anything?
Mostly my complaint is that documentation is wrong. But missing
documentation and badly scattered documentation isn't much better.
That page in the wiki is "how to compile programs" then email it to
this address.
It has little about what rules you'd like for submitted extensions.
It says nothing about how build scripts should be styled, or where to
stick them.
It does reference tcztools, a URL pointing at a rather old Half Gigabyte
project on the Google code archive but almost states you shouldn't use it.
It has a pointer to an "audit script" which doesn't run.
There is a reference to a "submitqc4" script but no indication as to
what or where it is, it's supposed to create the zsync file.
Eventually I guessed the name of the "audit script" in the repository
despite the explicit statement that it wasn't in the repository in the
linked forum messages.
The link to the "Guidelines" message seems to have two points, License,
and look in the 'News section under TC Extensions.' Neither of which is
helpful at this stage.
There's little indication what the various item in the info file
are for. Mostly that's okay, but "Tags", "Current" and probably
"Change-log" need more detail. Even the comments section probably needs
recommendations on contents. For example, should it really be called
"Long-description" ?
I'm also unclear what "build-dep" is actually for, from the example
it seems to be "build comments". I expect it was just included because
there doesn't seem to be anywhere to put a build script. So if I have
a build script should it actually go in that file.
But currently I'm guessing it goes in the ".tcz.tgz" file with a copy
of the exact source that was used to build it.
I think I've mostly discarded the old debris in the "documentation",
but frankly I expect I've still missed something. So here's a couple of
copies of a simple build script, does it do the right thing?
#!/bin/sh -
init_app() {
TCZNAME="easyrsa"
BUILDDEPS=''
COMPDIR="$(pwd)/tcz-comp/$TCZNAME"
BUILDDIR="$COMPDIR/build"
TREEDIR="$COMPDIR/tcztree"
REPO="$HOME/repo"
DIST="$HOME/dist"
FAKEROOT=sudo
}
info_file() {
cat <<!
Title: easyrsa.tcz
Description: OpenVPN - Easy RSA scripts
Version: $VER
Author: Various
Original-site: http://openvpn.net
Copying-policy: GPL (see usr/local/share/doc/openvpn/COPYING)
Size: $TCZSIZE
Extension_by: rdebath
Tags: OpenSSL easy
Comments: Downloaded from
https://github.com/OpenVPN/easy-rsa/releases/download/3.0.1/EasyRSA-3.0.1.tgz
Change-log: 2017-05-06 Initial release replacing OpenVPN embed.
Current: 2017-05-06 Initial release replacing OpenVPN embed.
!
}
unpack_app() {
VER=3.0.1
DISTFILE="$DIST/EasyRSA-3.0.1.tgz"
BUILDDIR="$COMPDIR/EasyRSA-$VER"
[ -d "$BUILDDIR" ] || {
tar xf "$DISTFILE"
cp -p "$DISTFILE" "$COMPDIR/src"
}
}
build_app() {
PREFIX=/usr/local
find_deps() { echo openssl.tcz ; }
}
install_app() {
$FAKEROOT mkdir -p "$TREEDIR$PREFIX"/bin
$FAKEROOT mkdir -p "$TREEDIR$PREFIX"/lib/easyrsa
$FAKEROOT mkdir -p "$TREEDIR$PREFIX"/share/doc/easyrsa
$FAKEROOT cp -rp x509-types easyrsa openssl-1.0.cnf "$TREEDIR$PREFIX"/lib/easyrsa/.
$FAKEROOT cp -rp ChangeLog doc COPYING README.quickstart.md vars.example gpl-2.0.txt "$TREEDIR$PREFIX"/share/doc/easyrsa/.
$FAKEROOT chown -R 0:0 "$TREEDIR$PREFIX"/lib/easyrsa "$TREEDIR$PREFIX"/share/doc/easyrsa
$FAKEROOT chmod -R g-s "$TREEDIR$PREFIX"/lib/easyrsa "$TREEDIR$PREFIX"/share/doc/easyrsa
$FAKEROOT dd of="$TREEDIR$PREFIX"/bin/easyrsa 2>/dev/null <<-!
#!/bin/sh
export EASYRSA="$PREFIX"/lib/easyrsa
export EASYRSA_PKI=/opt/easyrsa
mkdir -p "\$EASYRSA_PKI"
exec sh "$PREFIX/lib/easyrsa/easyrsa" "$@"
!
$FAKEROOT chmod +x "$TREEDIR$PREFIX"/bin/easyrsa
}
################################################################################
main() {
set -e
init_app
mkdir -p "$COMPDIR"/src
cp -p "$0" "$COMPDIR"/src/.
cd "$COMPDIR"
load_build_dep $BUILDDEPS squashfs-tools
cd "$COMPDIR"
unpack_app
cd "$BUILDDIR"
build_app
cd "$COMPDIR"
$FAKEROOT rm -rf "$TREEDIR"
$FAKEROOT mkdir -m 755 "$TREEDIR"
$FAKEROOT chmod u-s,g-ws,o-w "$TREEDIR"
$FAKEROOT chown 0:0 "$TREEDIR"
cd "$BUILDDIR"
install_app
cd "$COMPDIR"
$FAKEROOT mksquashfs "$TREEDIR" "$TCZNAME".tcz -noappend
TCZSIZE=$(du -h "$TCZNAME".tcz | cut -f 1)
info_file > "$TCZNAME".tcz.info
[ ! -s "$TCZNAME".tcz.info ] ||
cp "$TCZNAME".tcz.info "$REPO"/"$TCZNAME".tcz.info
mkdir -p "$REPO"
cp "$TCZNAME".tcz "$REPO"/"$TCZNAME".tcz
md5sum "$TCZNAME".tcz > "$REPO"/"$TCZNAME".tcz.md5.txt
(cd "$TREEDIR" ; find . ! -type d | sed 's/^\.\//\//' | sort) > "$REPO"/"$TCZNAME".tcz.list
{
[ "$BUILDDEPS" != "" ] && {
echo "$BUILDDEPS" | tr ' ' '\012'
}
} > "$REPO"/"$TCZNAME".tcz.build-dep
DEP="$(find_deps)"
[ -f "$REPO"/"$TCZNAME".tcz.dep ] && rm "$REPO"/"$TCZNAME".tcz.dep
[ "$DEP" != "" ] && echo "$DEP" > "$REPO"/"$TCZNAME".tcz.dep
(cd "$COMPDIR"/src; tar czf - *) > "$REPO"/"$TCZNAME".tcz.tgz
}
load_build_dep() {
# Download and load build depends IF NEEDED.
# DO NOT put in onboot.lst
TCEI=/usr/local/tce.installed
TCEDIR=/etc/sysconfig/tcedir
for i
do
ext="${i%.tcz}.tcz"
# Installed, okay.
[ ! -e "$TCEI/${ext%.tcz}" ] || continue
[ -f "$TCEDIR/optional/$ext" ] ||
tce-load -s -w "$ext"
tce-load -s -l -i "$ext"
done
}
find_deps() {
ls -nl $(find "$TREEDIR" -type f -perm /100 -exec ldd {} \; 2>/dev/null |
awk '/=>/{print $3;}') |
awk '/ ->.*\/tmp\/tcloop/{print $NF;}' |
awk -F/ '{print $4 ".tcz";}' |
sort -u
}
main "$@"
#!/bin/sh -
init_app() {
TCZNAME="openvpn"
BUILDDEPS='compiletc bash openssl-dev lzo-dev openssl lzo squashfs-tools xz'
COMPDIR="$(pwd)/tcz-comp/$TCZNAME"
BUILDDIR="$COMPDIR/build"
TREEDIR="$COMPDIR/tcztree"
REPO="$HOME/repo"
DIST="$HOME/dist"
FAKEROOT=sudo
}
info_file() {
cat <<!
Title: openvpn.tcz
Description: OpenVPN - Open Source Virtual Private Network
Version: $VER
Author: Various
Original-site: http://openvpn.net
Copying-policy: GPL (see usr/local/share/doc/openvpn/COPYING)
Size: $TCZSIZE
Extension_by: rdebath
Tags: VPN connection network OpenVPN
Comments: For further information please visit
http://openvpn.net/index.php/open-source/documentation/howto.html
For client access use:
$ sudo openvpn --config /path/to/your/conf
---
Change-log: 2010/10/24 Initial version 2.1.3
2010/11/19 Resolved iproute2 dep, bump to 2.1.4
2012/03/09 Bump to 2.2.2, recompiled for TC4 against openssl-1.0.0, removed bash as needed shell
Current: 2017/05/06 Bump to 2.4.1, recompiled for TC8 against openssl-1.0.2k, easy-rsa no longer included, smartcard support too old.
!
}
unpack_app() {
VER=2.4.1
DISTFILE="$DIST/openvpn-$VER.tar.xz"
BUILDDIR="$COMPDIR/openvpn-$VER"
[ -d "$BUILDDIR" ] || {
tar xf "$DISTFILE"
cp -p "$DISTFILE" "$COMPDIR/src"
}
}
build_app() {
[ -f configure -a ! -f Makefile ] &&
./configure \
--enable-x509-alt-username \
--disable-plugin-auth-pam \
--prefix=/usr/local
make
}
install_app() {
$FAKEROOT make install-strip DESTDIR="$TREEDIR"
$FAKEROOT xz "$TREEDIR"/usr/local/share/man/man8/openvpn.8
}
################################################################################
main() {
set -e
init_app
mkdir -p "$COMPDIR"/src
cp -p "$0" "$COMPDIR"/src/.
cd "$COMPDIR"
load_build_dep $BUILDDEPS squashfs-tools
cd "$COMPDIR"
unpack_app
cd "$BUILDDIR"
build_app
cd "$COMPDIR"
$FAKEROOT rm -rf "$TREEDIR"
$FAKEROOT mkdir -m 755 "$TREEDIR"
$FAKEROOT chmod u-s,g-ws,o-w "$TREEDIR"
$FAKEROOT chown 0:0 "$TREEDIR"
cd "$BUILDDIR"
install_app
cd "$COMPDIR"
$FAKEROOT mksquashfs "$TREEDIR" "$TCZNAME".tcz -noappend
TCZSIZE=$(du -h "$TCZNAME".tcz | cut -f 1)
info_file > "$TCZNAME".tcz.info
[ ! -s "$TCZNAME".tcz.info ] ||
cp "$TCZNAME".tcz.info "$REPO"/"$TCZNAME".tcz.info
mkdir -p "$REPO"
cp "$TCZNAME".tcz "$REPO"/"$TCZNAME".tcz
md5sum "$TCZNAME".tcz > "$REPO"/"$TCZNAME".tcz.md5.txt
(cd "$TREEDIR" ; find . ! -type d | sed 's/^\.\//\//' | sort) > "$REPO"/"$TCZNAME".tcz.list
{
[ "$BUILDDEPS" != "" ] && {
echo "$BUILDDEPS" | tr ' ' '\012'
}
} > "$REPO"/"$TCZNAME".tcz.build-dep
DEP="$(find_deps)"
[ -f "$REPO"/"$TCZNAME".tcz.dep ] && rm "$REPO"/"$TCZNAME".tcz.dep
[ "$DEP" != "" ] && echo "$DEP" > "$REPO"/"$TCZNAME".tcz.dep
(cd "$COMPDIR"/src; tar czf - *) > "$REPO"/"$TCZNAME".tcz.tgz
}
load_build_dep() {
# Download and load build depends IF NEEDED.
# DO NOT put in onboot.lst
TCEI=/usr/local/tce.installed
TCEDIR=/etc/sysconfig/tcedir
for i
do
ext="${i%.tcz}.tcz"
# Installed, okay.
[ ! -e "$TCEI/${ext%.tcz}" ] || continue
[ -f "$TCEDIR/optional/$ext" ] ||
tce-load -s -w "$ext"
tce-load -s -l -i "$ext"
done
}
find_deps() {
ls -nl $(find "$TREEDIR" -type f -perm /100 -exec ldd {} \; 2>/dev/null |
awk '/=>/{print $3;}') |
awk '/ ->.*\/tmp\/tcloop/{print $NF;}' |
awk -F/ '{print $4 ".tcz";}' |
sort -u
}
main "$@"