Adding Openbsd to stats repository

Here we are !!

We are in the battle of powerpc arch, thanks to OpenBSD I have working some MacMini and other old powerpc arch!!

You can download this –> https://pkgstat-openbsd.perso.pw/?utm_source=discoverbsd


```
bash-4.4$ cat send_stats.sh
#!/bin/sh

# https://pkgstat-openbsd.perso.pw/receive.php
STATHOST=pkgstat-openbsd.perso.pw
STATPATH=/receive.php

OS=$(uname -s)
if [ ! "$OS" = "OpenBSD" ]
then
printf "$OS isn't supported\n"
exit 2
fi

MACHINE_ID=$((mount -v | sed -ne 's,.* (\(.*\)) on / .*,\1,p'; \
sysctl hw.uuid; hostname) | sha256)
ARCH=$(uname -p)
VERSION=$(sysctl -n kern.version | awk '/^OpenBSD/ { print $2 }')

# Package list with categories and flavors
PKG_LIST=$(pkg_info -q -P)

DATA="uuid=$MACHINE_ID&arch=$ARCH&osversion=$VERSION&pkglist=$PKG_LIST"
# SENDING DATAAAAAAAA !
printf '%s\r\n' \
"POST $STATPATH HTTP/1.1" \
"Host: $STATHOST" \
'User-Agent: sendstats' \
'Accept: */*' \
"Content-length: ${#DATA}" \
'Content-Type: application/x-www-form-urlencoded' \
'' \
"$DATA" \
| nc -w 1 -c "$STATHOST" 443

# Did it work ?
if [ $? -ne 0 ]
then
printf 'Could not send data\n'
exit 3
fi
```

And then you can run it !


bash-4.4$ ./send_stats.sh
sysctl: hw.uuid: value is not available
HTTP/1.1 200 OK
Connection: keep-alive
Content-type: text/html; charset=UTF-8
Date: Sat, 26 Jan 2019 15:55:18 GMT
Server: OpenBSD httpd
Transfer-Encoding: chunked
X-Powered-By: PHP/7.0.32

21
Hello ! You are new ! Welcome :)

0

bash-4.4$

Just wait to see my packaged added there !

Leave a Reply