From 4dd26ec92b80aca893a7d37b1d498f95fca23e1f Mon Sep 17 00:00:00 2001 From: jahway603 Date: Wed, 29 Sep 2021 00:50:38 -0400 Subject: [PATCH 1/9] minor update to build.sh --- build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sh b/build.sh index 0287abd..7d58360 100755 --- a/build.sh +++ b/build.sh @@ -9,6 +9,7 @@ if ! [ -x "$(command -v go)" ]; then fi # now to compiling... +echo "You have go installed, so starting to compile hush lightwalletd for you..." cd `pwd`/cmd/server go build -o lightwalletd main.go mv lightwalletd `pwd`/../../lightwalletd From b33b4b476fff28bd8a6ff099f44ad675aacefe95 Mon Sep 17 00:00:00 2001 From: jahway603 Date: Wed, 29 Sep 2021 02:04:48 -0400 Subject: [PATCH 2/9] working towards lightwalletd deb package --- build.sh | 12 ++++++++++++ cmd/server/main.go | 9 +++++++++ cmd/server/main_test.go | 32 ++++++++++++++++++++++++++++++++ frontend/service.go | 2 +- 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 cmd/server/main_test.go diff --git a/build.sh b/build.sh index 7d58360..f9a9794 100755 --- a/build.sh +++ b/build.sh @@ -8,10 +8,22 @@ if ! [ -x "$(command -v go)" ]; then exit 1 fi +echo "" +echo "Welcome to the Hush magic folks..." +echo "" +echo ".------..------..------..------..------..------..------..------..------..------..------..------." +echo "|L.--. ||I.--. ||G.--. ||H.--. ||T.--. ||W.--. ||A.--. ||L.--. ||L.--. ||E.--. ||T.--. ||D.--. |" +echo "| :/\: || (\/) || :/\: || :/\: || :/\: || :/\: || (\/) || :/\: || :/\: || (\/) || :/\: || :/\: |" +echo "| (__) || :\/: || :\/: || (__) || (__) || :\/: || :\/: || (__) || (__) || :\/: || (__) || (__) |" +echo "| '--'L|| '--'I|| '--'G|| '--'H|| '--'T|| '--'W|| '--'A|| '--'L|| '--'L|| '--'E|| '--'T|| '--'D|" +echo "+------'+------'+------'+------'+------'+------'+------'+------'+------'+------'+------'+------'" + # now to compiling... +echo "" echo "You have go installed, so starting to compile hush lightwalletd for you..." cd `pwd`/cmd/server go build -o lightwalletd main.go mv lightwalletd `pwd`/../../lightwalletd +echo "" echo "lightwalletd is now compiled for you." echo "for options, run ./lightwalletd --help" diff --git a/cmd/server/main.go b/cmd/server/main.go index 31ef6b9..1c72be3 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -3,6 +3,7 @@ package main import ( "context" "flag" + "fmt" "net" "os" "os/signal" @@ -97,6 +98,14 @@ func main() { flag.StringVar(&opts.hush3ConfPath, "conf-file", "", "conf file to pull RPC creds from") flag.IntVar(&opts.cacheSize, "cache-size", 40000, "number of blocks to hold in the cache") + // creating --version so help2man will work + if len(os.Args) > 1 && (os.Args[1] == "--version" || os.Args[1] == "-v") { + // TODO find a better method than hardcode the version number here + fmt.Printf("hush lightwalletd version 0.1.1\n") + os.Exit(0) + } + // TODO determine why help2man is now complaining about --help even after I tried creating one... + // TODO prod metrics // TODO support config from file and env vars flag.Parse() diff --git a/cmd/server/main_test.go b/cmd/server/main_test.go new file mode 100644 index 0000000..77cf485 --- /dev/null +++ b/cmd/server/main_test.go @@ -0,0 +1,32 @@ +// Copyright 2021 The Hush developers +// Released under the GPLv3 +package main + +import ( + "os" + "testing" +) + +// TestFileExists checks whether or not the file exists +func TestFileExists(t *testing.T) { + if fileExists("nonexistent-file") { + t.Fatal("fileExists unexpected success") + } + // If the path exists but is a directory, should return false + if fileExists(".") { + t.Fatal("fileExists unexpected success") + } + // The following file should exist, it's what's being tested + if !fileExists("main.go") { + t.Fatal("fileExists failed") + } +} + +// fileExists checks if file exists and is not directory to prevent further errors +func fileExists(filename string) bool { + info, err := os.Stat(filename) + if os.IsNotExist(err) { + return false + } + return !info.IsDir() +} diff --git a/frontend/service.go b/frontend/service.go index 08f45ea..998628e 100644 --- a/frontend/service.go +++ b/frontend/service.go @@ -249,7 +249,7 @@ func (s *SqlStreamer) GetLightdInfo(ctx context.Context, in *walletrpc.Empty) (* // TODO these are called Error but they aren't at the moment. // A success will return code 0 and message txhash. return &walletrpc.LightdInfo{ - Version: "0.1-hushlightd", + Version: "0.1.1-hushlightd", Vendor: "Silentdragonlite LightWalletD", TaddrSupport: true, ChainName: chainName, From 57ea75af6710b3f6a6f9a16c8408e59596359dee Mon Sep 17 00:00:00 2001 From: jahway603 Date: Fri, 1 Oct 2021 23:06:29 -0400 Subject: [PATCH 3/9] manually created manpage --- doc/man/lightwalletd.1 | 67 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 doc/man/lightwalletd.1 diff --git a/doc/man/lightwalletd.1 b/doc/man/lightwalletd.1 new file mode 100644 index 0000000..a54a3c9 --- /dev/null +++ b/doc/man/lightwalletd.1 @@ -0,0 +1,67 @@ +.TH LIGHTWALLET "1" "October 2021" "lightwalletd v0.1.1" "User Commands" +.SH NAME +lightwalletd \- manual page for hush lightwalletd v0.1.1 +.SH DESCRIPTION +.B lightwalletd +runs a lightwallet daemon for a Hush Silent Dragon Lite node. +.PP +In order to ensure you are adequately protecting your privacy when using Hush, +please see . +.SS "Usage:" +.TP +.B lightwalletd [options] +Start Hush lightwalletd +.TP +lightwalletd --help +List available command line options +.TP +lightwalletd --version +Display version information +.SH OPTIONS +.HP +\fB\-help | -h | -? +.IP +Display command line options +.HP +\fB\-conf-file\fR [conf_file location] +.IP +Configures your HUSH3.conf file location [Required to run]. Typically ~/.hush/HUSH3/HUSH3.conf +.HP +\fB\-bind-addr \fRhost.net:chosen_port +.IP +Set host.net to either a FQDN or 127.0.0.1 depending on your configuration [Required to run]. Most common port is 9067 unless changed. +.HP +\fB\-no-tls +.IP +Disable TLS, serve un-encrypted traffic. Toggle depending on your configuration. +.HP +\fB\-cache-size \fRint +.IP +Set number of blocks to hold in the cache (default 40000) +.HP +\fB\-log-file \fRstring +.IP +Set log file to write to +.HP +\fB\-log-level \fRuint +.IP +log level (logrus 1-7) (default 4) +.HP +\fB\-tls-cert \fRstring +.IP +the path to a TLS certificate (optional) +.HP +\fB\-tls-key \fRstring +.IP +the path to a TLS key file (optional) + +.SH COPYRIGHT +In order to ensure you are adequately protecting your privacy when using Hush, +please see . + +Copyright (C) 2021 Jahway603 and The Hush Developers + +This is experimental Free Software! Fuck Yeah!!!!! + +Distributed under the GPLv3 software license, see the accompanying file COPYING +or . From edac479e7dc1151f2d0d6f1b65c3265b03ae7b5a Mon Sep 17 00:00:00 2001 From: jahway603 Date: Thu, 21 Oct 2021 16:07:14 -0400 Subject: [PATCH 4/9] changed to variable --- build.sh | 6 +++--- cmd/server/main.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index f9a9794..7a47e44 100755 --- a/build.sh +++ b/build.sh @@ -20,10 +20,10 @@ echo "+------'+------'+------'+------'+------'+------'+------'+------'+------'+- # now to compiling... echo "" -echo "You have go installed, so starting to compile hush lightwalletd for you..." +echo "You have go installed, so starting to compile Hush lightwalletd for you..." cd `pwd`/cmd/server go build -o lightwalletd main.go mv lightwalletd `pwd`/../../lightwalletd echo "" -echo "lightwalletd is now compiled for you." -echo "for options, run ./lightwalletd --help" +echo "Hush lightwalletd is now compiled for you. Enjoy and reach out if you need support." +echo "For options, run ./lightwalletd --help" diff --git a/cmd/server/main.go b/cmd/server/main.go index 1c72be3..fb4be3a 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -88,6 +88,8 @@ type Options struct { } func main() { + var version = "0.1.1" // set version number + opts := &Options{} flag.StringVar(&opts.bindAddr, "bind-addr", "127.0.0.1:9069", "the address to listen on") flag.StringVar(&opts.tlsCertPath, "tls-cert", "", "the path to a TLS certificate (optional)") @@ -98,13 +100,11 @@ func main() { flag.StringVar(&opts.hush3ConfPath, "conf-file", "", "conf file to pull RPC creds from") flag.IntVar(&opts.cacheSize, "cache-size", 40000, "number of blocks to hold in the cache") - // creating --version so help2man will work + // creating --version as a requirement of help2man if len(os.Args) > 1 && (os.Args[1] == "--version" || os.Args[1] == "-v") { - // TODO find a better method than hardcode the version number here - fmt.Printf("hush lightwalletd version 0.1.1\n") + fmt.Printf("Hush lightwalletd version " + version + "\n") os.Exit(0) } - // TODO determine why help2man is now complaining about --help even after I tried creating one... // TODO prod metrics // TODO support config from file and env vars From 8fefcab08cfb17edecad765e868b3b5a2d93571f Mon Sep 17 00:00:00 2001 From: jahway603 Date: Sat, 23 Oct 2021 23:36:19 -0400 Subject: [PATCH 5/9] added Makefile --- Makefile | 20 ++++++++++++++++++++ README.md | 6 +++--- build.sh => util/build.sh | 0 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 Makefile rename build.sh => util/build.sh (100%) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6e396ff --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +# Copyright (c) 2021 Jahway603 & The Hush Developers +# Released under the GPLv3 +# +# Hush Lightwalletd Makefile +# author: jahway603 +# +PROJECT_NAME := "lightwalletd" +GOCMD=go +GOTEST=$(GOCMD) test +GOVET=$(GOCMD) vet + +#.PHONY: build + +build: + # Build binary + ./util/build.sh + +clean: + @echo "clean project..." + rm -f $(PROJECT_NAME) diff --git a/README.md b/README.md index c565838..6c1c833 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ You will need Go >= 1.13 which you can download from the official [download page This [installation](https://golang.org/doc/install) document shows how to do it on various OS's. -If you're using Ubuntu, try: +If you're using Ubuntu or Debian, try: ``` $ sudo apt install golang @@ -50,7 +50,7 @@ Then start `hushd` in your command window. You might need to run with `-reindex` Run the build script. ``` -./build.sh +make build ``` #### 3. Get a TLS certificate and run the Lightwalletd frontend @@ -115,7 +115,7 @@ These are the current different command line options for lightwalletd: | CLI option | Default | What it does | |------------|:--------------:|------------------------------:| -| -bind-addr | 127.0.0.1:9069 | address and port to listen on | +| -bind-addr | 127.0.0.1:9067 | address and port to listen on | | -tls-cert | blank | the path to a TLS certificate | | -tls-key | blank | the path to a TLS key file | | -no-tls | false | Disable TLS, serve un-encrypted traffic | diff --git a/build.sh b/util/build.sh similarity index 100% rename from build.sh rename to util/build.sh From 749f2ee743f2892059bed85529095e2cb8f8f088 Mon Sep 17 00:00:00 2001 From: jahway603 Date: Sun, 24 Oct 2021 01:39:15 -0400 Subject: [PATCH 6/9] new lightwalletd deb build script --- Makefile | 11 ++- cmd/server/main.go | 2 +- contrib/debian/changelog | 5 + contrib/debian/control | 13 +++ contrib/debian/copyright | 6 ++ contrib/debian/examples/HUSH3.conf | 141 +++++++++++++++++++++++++++++ contrib/debian/files | 1 + contrib/debian/postinst | 39 ++++++++ contrib/debian/postrm | 37 ++++++++ contrib/debian/preinst | 35 +++++++ contrib/debian/prerm | 38 ++++++++ util/build-debian-package.sh | 98 ++++++++++++++++++++ 12 files changed, 424 insertions(+), 2 deletions(-) create mode 100644 contrib/debian/changelog create mode 100644 contrib/debian/control create mode 100644 contrib/debian/copyright create mode 100644 contrib/debian/examples/HUSH3.conf create mode 100644 contrib/debian/files create mode 100644 contrib/debian/postinst create mode 100644 contrib/debian/postrm create mode 100644 contrib/debian/preinst create mode 100644 contrib/debian/prerm create mode 100755 util/build-debian-package.sh diff --git a/Makefile b/Makefile index 6e396ff..5dec468 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,15 @@ build: # Build binary ./util/build.sh +# Stop the hushd process in the hushdlwd container +#docker_img_stop_hushd: +# docker exec -i hushdlwd hush-cli stop + +# Remove and delete ALL images and containers in Docker; assumes containers are stopped +#docker_remove_all: +# docker system prune -f + clean: - @echo "clean project..." + @echo "Cleaning project $(PROJECT_NAME) files..." rm -f $(PROJECT_NAME) + rm -rf /tmp/$(PROJECT_NAME)-* diff --git a/cmd/server/main.go b/cmd/server/main.go index fb4be3a..209c267 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -91,7 +91,7 @@ func main() { var version = "0.1.1" // set version number opts := &Options{} - flag.StringVar(&opts.bindAddr, "bind-addr", "127.0.0.1:9069", "the address to listen on") + flag.StringVar(&opts.bindAddr, "bind-addr", "127.0.0.1:9067", "the address to listen on") flag.StringVar(&opts.tlsCertPath, "tls-cert", "", "the path to a TLS certificate (optional)") flag.StringVar(&opts.tlsKeyPath, "tls-key", "", "the path to a TLS key file (optional)") flag.BoolVar(&opts.noTLS, "no-tls", false, "Disable TLS, serve un-encrypted traffic.") diff --git a/contrib/debian/changelog b/contrib/debian/changelog new file mode 100644 index 0000000..e74afbe --- /dev/null +++ b/contrib/debian/changelog @@ -0,0 +1,5 @@ +lightwalletd (0.1.1) stable; urgency=medium + + * 0.1.1 release. + + -- Hush Core Sunday, 24 Oct 2021 13:40:30 -0700 diff --git a/contrib/debian/control b/contrib/debian/control new file mode 100644 index 0000000..1ba4da8 --- /dev/null +++ b/contrib/debian/control @@ -0,0 +1,13 @@ +Source: lightwalletd +Section: utils +Priority: optional +Maintainer: Jahway603 +Homepage: https://hush.is +Build-Depends: go +Vcs-Git: https://git.hush.is/hush/lightwalletd.git +Vcs-Browser: https://git.hush.is/hush/lightwalletd + +Package: lightwalletd +Architecture: amd64 +Depends: ${shlibs:Depends} +Description: Hush lightwallet daemon to run a Silent Dragon Lite server. Speak And Transact Freely. Hush inherits from Bitcoin Protocol and Zcash Protocol and is focused on private communications. diff --git a/contrib/debian/copyright b/contrib/debian/copyright new file mode 100644 index 0000000..dd64ecf --- /dev/null +++ b/contrib/debian/copyright @@ -0,0 +1,6 @@ +Files: * +Copyright: 2019-2021, The Hush developers + 2018-2019, The Zcash developers +License: GPLv3 +Comment: https://hush.is/developers + diff --git a/contrib/debian/examples/HUSH3.conf b/contrib/debian/examples/HUSH3.conf new file mode 100644 index 0000000..5d6c0fe --- /dev/null +++ b/contrib/debian/examples/HUSH3.conf @@ -0,0 +1,141 @@ +## HUSH3.conf configuration file. Lines beginning with # are comments. + +# Network-related settings: + +# Run a regression test network +#regtest=0 + +# Connect via a SOCKS5 proxy +#proxy=127.0.0.1:9050 + +# Bind to given address and always listen on it. Use [host]:port notation for IPv6 +#bind= + +# Bind to given address and allowlist peers connecting to it. Use [host]:port notation for IPv6 +#allowbind= + +############################################################## +## Quick Primer on addnode vs connect ## +## Let's say for instance you use addnode=4.2.2.4 ## +## addnode will connect you to and tell you about the ## +## nodes connected to 4.2.2.4. In addition it will tell ## +## the other nodes connected to it that you exist so ## +## they can connect to you. ## +## connect will not do the above when you 'connect' to it. ## +## It will *only* connect you to 4.2.2.4 and no one else.## +## ## +## So if you're behind a firewall, or have other problems ## +## finding nodes, add some using 'addnode'. ## +## ## +## If you want to stay private, use 'connect' to only ## +## connect to "trusted" nodes. ## +## ## +## If you run multiple nodes on a LAN, there's no need for ## +## all of them to open lots of connections. Instead ## +## 'connect' them all to one node that is port forwarded ## +## and has lots of connections. ## +## Thanks goes to [Noodle] on Freenode. ## +############################################################## + +# Use as many addnode= settings as you like to connect to specific peers +#addnode=69.164.218.197 +#addnode=10.0.0.2:8233 + +# Alternatively use as many connect= settings as you like to connect ONLY to specific peers +#connect=69.164.218.197 +#connect=10.0.0.1:8233 + +# Listening mode, enabled by default except when 'connect' is being used +#listen=1 + +# Maximum number of inbound+outbound connections. +#maxconnections= + +# +# JSON-RPC options (for controlling a running hushd process) +# + +# server=1 tells node to accept JSON-RPC commands (set as default if not specified) +#server=1 + +# Bind to given address to listen for JSON-RPC connections. Use [host]:port notation for IPv6. +# This option can be specified multiple times (default: bind to all interfaces) +#rpcbind= + +# You must set rpcuser and rpcpassword to secure the JSON-RPC api +#rpcuser=Ulysses +#rpcpassword=YourSuperGreatPasswordNumber_DO_NOT_USE_THIS_OR_YOU_WILL_GET_ROBBED_385593 + +# How many seconds node will wait for a complete RPC HTTP request. +# after the HTTP connection is established. +#rpcclienttimeout=30 + +# By default, only RPC connections from localhost are allowed. +# Specify as many rpcallowip= settings as you like to allow connections from other hosts, +# either as a single IPv4/IPv6 or with a subnet specification. + +# NOTE: opening up the RPC port to hosts outside your local trusted network is NOT RECOMMENDED, +# because the rpcpassword is transmitted over the network unencrypted and also because anyone +# that can authenticate on the RPC port can steal your keys + take over the account running hushd + +#rpcallowip=10.1.1.34/255.255.255.0 +#rpcallowip=1.2.3.4/24 +#rpcallowip=2001:db8:85a3:0:0:8a2e:370:7334/96 + +# Listen for RPC connections on this TCP port (default 18031): +#rpcport=18031 + +# You can use hushd to send commands to hushd +# running on another host using this option: +#rpcconnect=127.0.0.1 + +# Do not see these options listed in here, but it is in my production lightwalletd config file +#rpcworkqueue=256 +#rpcbind=127.0.0.1 + +# Transaction Fee + +# Send transactions as zero-fee transactions if possible (default: 0) +#sendfreetransactions=0 + +# Create transactions that have enough fees (or priority) so they are likely to # begin confirmation within n blocks (default: 1). +# This setting is overridden by the -paytxfee option. +#txconfirmtarget=n + +# Miscellaneous options + +# Enable attempt to mine HUSH +#gen=0 + +# Set the number of threads to be used for mining (-1 = all cores). +#genproclimit=1 + +# Specify a different Equihash solver (e.g. "tromp") to try to mine +# faster when gen=1. +#equihashsolver=default + +# Pre-generate this many public/private key pairs, so wallet backups will be valid for +# both prior transactions and several dozen future transactions. +#keypool=100 + +# Pay an optional transaction fee every time you send a tx. Transactions with fees +# are more likely than free transactions to be included in generated blocks, so may +# be validated sooner. This setting does not affect private transactions created with +# 'z_sendmany'. +#paytxfee=0.00 + +#Rewind the chain to specific block height. This is useful for creating snapshots at a given block height. +#rewind=777777 + +#Stop the chain a specific block height. This is useful for creating snapshots at a given block height. +#stopat=1000000 + +#Set an address to use as change address for all transactions. This value must be set to a 33 byte pubkey. All mined coins will also be sent to this address. +#pubkey=027dc7b5cfb5efca96674b45e9fda18df069d040b9fd9ff32c35df56005e330392 + +#Forfeit all user rewards to miners. Set this to explicitly not claim user rewards. +#exchange=1 + +#Donate all user rewards to a a specific address. This value must be set to a 33 byte pubkey. +#donation=027dc7b5cfb5efca96674b45e9fda18df069d040b9fd9ff32c35df56005e330392 + diff --git a/contrib/debian/files b/contrib/debian/files new file mode 100644 index 0000000..15b50e2 --- /dev/null +++ b/contrib/debian/files @@ -0,0 +1 @@ +lightwalletd_0.1.1_amd64.deb utils optional diff --git a/contrib/debian/postinst b/contrib/debian/postinst new file mode 100644 index 0000000..e841dc3 --- /dev/null +++ b/contrib/debian/postinst @@ -0,0 +1,39 @@ +#!/bin/sh +# postinst script for lightwalletd +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/contrib/debian/postrm b/contrib/debian/postrm new file mode 100644 index 0000000..b65e402 --- /dev/null +++ b/contrib/debian/postrm @@ -0,0 +1,37 @@ +#!/bin/sh +# postrm script for lightwalletd +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/contrib/debian/preinst b/contrib/debian/preinst new file mode 100644 index 0000000..f066674 --- /dev/null +++ b/contrib/debian/preinst @@ -0,0 +1,35 @@ +#!/bin/sh +# preinst script for lightwalletd + +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/contrib/debian/prerm b/contrib/debian/prerm new file mode 100644 index 0000000..a2eb73a --- /dev/null +++ b/contrib/debian/prerm @@ -0,0 +1,38 @@ +#!/bin/sh +# prerm script for lightwalletd +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/util/build-debian-package.sh b/util/build-debian-package.sh new file mode 100755 index 0000000..a8d695a --- /dev/null +++ b/util/build-debian-package.sh @@ -0,0 +1,98 @@ +#!/bin/bash +# Copyright (c) 2021 The Hush developers +# Distributed under the GPLv3 software license, see the accompanying +# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html + +## Usage: ./util/build-debian-package.sh + +echo "Let's see who read the README.md or not..." +echo "" + +# Check if lightwalletd is already built on system and exit if it is not +if ! [ -x "$(command -v ./lightwalletd)" ]; then + echo 'Error: lightwalletd is not compiled yet. Run "make build" and try again.' >&2 + echo "" + exit 1 +fi + +# Check if lintian is installed and exit if it is not +#if ! [ -x "$(command -v lintian)" ]; then +# echo 'Error: lintian is not installed yet. Consult your Linux version package manager...' >&2 +# echo "" +# exit 1 +#fi + +echo "Let There Be Hush Lightwalletd Debian Packages!" +echo "" +echo "((_,...,_))" +echo " |o o|" +echo " \ /" +echo " ^_^ cp97" +echo "" + +set -e +set -x + +BUILD_PATH="/tmp/lightwalletd-debian-$$" +PACKAGE_NAME="lightwalletd" +SRC_PATH=`pwd` +SRC_DEB=$SRC_PATH/contrib/debian +SRC_DOC=$SRC_PATH/doc +ARCH="amd64" + +umask 022 + +if [ ! -d $BUILD_PATH ]; then + mkdir $BUILD_PATH +fi + +PACKAGE_VERSION=0.1.1 +DEBVERSION=$(echo $PACKAGE_VERSION) +BUILD_DIR="$BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH" + +if [ -d $BUILD_DIR ]; then + rm -R $BUILD_DIR +fi + +DEB_BIN=$BUILD_DIR/usr/bin +DEB_CMP=$BUILD_DIR/usr/share/bash-completion/completions +DEB_DOC=$BUILD_DIR/usr/share/doc/$PACKAGE_NAME +DEB_MAN=$BUILD_DIR/usr/share/man/man1 +DEB_SHR=$BUILD_DIR/usr/share/hush +mkdir -p $BUILD_DIR/DEBIAN $DEB_CMP $DEB_BIN $DEB_DOC $DEB_MAN $DEB_SHR +chmod 0755 -R $BUILD_DIR/* + +# Package maintainer scripts (currently empty) +#cp $SRC_DEB/postinst $BUILD_DIR/DEBIAN +#cp $SRC_DEB/postrm $BUILD_DIR/DEBIAN +#cp $SRC_DEB/preinst $BUILD_DIR/DEBIAN +#cp $SRC_DEB/prerm $BUILD_DIR/DEBIAN + +# Copy binary +cp $SRC_PATH/lightwalletd $DEB_BIN/lightwalletd +strip $DEB_BIN/lightwalletd +cp $SRC_DEB/changelog $DEB_DOC +cp $SRC_DEB/copyright $DEB_DOC +cp -r $SRC_DEB/examples $DEB_DOC +# Copy manpage +cp $SRC_DOC/man/lightwalletd.1 $DEB_MAN/lightwalletd.1 + +# Gzip files +gzip --best -n $DEB_MAN/lightwalletd.1 + +cd $SRC_PATH/contrib + +# Create the control file +# had to comment line below to move forward in this build script... +#dpkg-shlibdeps $DEB_BIN/lightwalletd +dpkg-gencontrol -P$BUILD_DIR -v$DEBVERSION + +# Create the Debian package +fakeroot dpkg-deb --build $BUILD_DIR +cp $BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb $SRC_PATH +shasum -a 256 $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb +# Analyze with Lintian, reporting bugs and policy violations +# Arch does not have lintian, as it's a Debian package, so commenting this out +# To-DO - test on Debian/Ubuntu, create AUR lintian package +#lintian -i $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb +exit 0 From 5418447897ada8a6fae688ee870807e864c76792 Mon Sep 17 00:00:00 2001 From: jahway603 Date: Mon, 25 Oct 2021 17:26:17 -0400 Subject: [PATCH 7/9] arm build scripts --- Makefile | 4 ++ util/build-debian-package-SBC.sh | 94 ++++++++++++++++++++++++++++++++ util/build-debian-package.sh | 4 +- util/build.sh | 5 +- util/build_arm.sh | 34 ++++++++++++ 5 files changed, 138 insertions(+), 3 deletions(-) create mode 100755 util/build-debian-package-SBC.sh create mode 100755 util/build_arm.sh diff --git a/Makefile b/Makefile index 5dec468..d2a920d 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,10 @@ build: # Build binary ./util/build.sh +build-arm: + # Build binary for ARM architecture (aarch64) + ./util/build_arm.sh + # Stop the hushd process in the hushdlwd container #docker_img_stop_hushd: # docker exec -i hushdlwd hush-cli stop diff --git a/util/build-debian-package-SBC.sh b/util/build-debian-package-SBC.sh new file mode 100755 index 0000000..c009a14 --- /dev/null +++ b/util/build-debian-package-SBC.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +# Copyright (c) 2021 The Hush developers +# Distributed under the GPLv3 software license, see the accompanying +# file LICENSE or https://www.gnu.org/licenses/gpl-3.0.en.html +# +# Remix for SBC (Single Board Computer) like PineBook, Rock64, Raspberry Pi, etc. +## Usage: ./util/build-debian-package-SBC.sh + +echo "Let's see who read the README.md or not..." +echo "" + +# Check if lightwalletd is already built on system and exit if it is not +if ! [ -x "$(command -v ./lightwalletd)" ]; then + echo 'Error: lightwalletd is not compiled yet. Run "make build" and try again.' >&2 + echo "" + exit 1 +fi + +# TODO - check that the lightwalletd binary is not x86 and is actually aarch64 + +echo "Let There Be Hush Lightwalletd Debian Packages for ARM!!!" +echo "" +echo "((_,...,_))" +echo " |o o|" +echo " \ /" +echo " ^_^ cp97" +echo "" + +set -e +set -x + +BUILD_PATH="/tmp/lightwalletd-debian-$$" +PACKAGE_NAME="lightwalletd" +SRC_PATH=`pwd` +SRC_DEB=$SRC_PATH/contrib/debian +SRC_DOC=$SRC_PATH/doc +ARCH="aarch64" + +umask 022 + +if [ ! -d $BUILD_PATH ]; then + mkdir $BUILD_PATH +fi + +PACKAGE_VERSION=0.1.1 +DEBVERSION=$(echo $PACKAGE_VERSION) +BUILD_DIR="$BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH" + +if [ -d $BUILD_DIR ]; then + rm -R $BUILD_DIR +fi + +DEB_BIN=$BUILD_DIR/usr/bin +DEB_CMP=$BUILD_DIR/usr/share/bash-completion/completions +DEB_DOC=$BUILD_DIR/usr/share/doc/$PACKAGE_NAME +DEB_MAN=$BUILD_DIR/usr/share/man/man1 +DEB_SHR=$BUILD_DIR/usr/share/hush +mkdir -p $BUILD_DIR/DEBIAN $DEB_CMP $DEB_BIN $DEB_DOC $DEB_MAN $DEB_SHR +chmod 0755 -R $BUILD_DIR/* + +# Package maintainer scripts (currently empty) +#cp $SRC_DEB/postinst $BUILD_DIR/DEBIAN +#cp $SRC_DEB/postrm $BUILD_DIR/DEBIAN +#cp $SRC_DEB/preinst $BUILD_DIR/DEBIAN +#cp $SRC_DEB/prerm $BUILD_DIR/DEBIAN + +# Copy binary +cp $SRC_PATH/lightwalletd $DEB_BIN/lightwalletd +#strip $DEB_BIN/lightwalletd # script complained, so comment out... +cp $SRC_DEB/changelog $DEB_DOC +cp $SRC_DEB/copyright $DEB_DOC +cp -r $SRC_DEB/examples $DEB_DOC +# Copy manpage +cp $SRC_DOC/man/lightwalletd.1 $DEB_MAN/lightwalletd.1 + +# Gzip files +gzip --best -n $DEB_MAN/lightwalletd.1 + +cd $SRC_PATH/contrib + +# Create the control file +# had to comment line below to move forward in this build script... +#dpkg-shlibdeps $DEB_BIN/lightwalletd +dpkg-gencontrol -P$BUILD_DIR -v$DEBVERSION + +# Create the Debian package +fakeroot dpkg-deb --build $BUILD_DIR +cp $BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb $SRC_PATH +shasum -a 256 $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb +# Analyze with Lintian, reporting bugs and policy violations +# Arch does not have lintian, as it's a Debian package, so commenting this out +# To-DO - test on Debian/Ubuntu, create AUR lintian package +#lintian -i $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb +exit 0 diff --git a/util/build-debian-package.sh b/util/build-debian-package.sh index a8d695a..c9d6fd0 100755 --- a/util/build-debian-package.sh +++ b/util/build-debian-package.sh @@ -1,8 +1,8 @@ #!/bin/bash # Copyright (c) 2021 The Hush developers # Distributed under the GPLv3 software license, see the accompanying -# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html - +# file LICENSE or https://www.gnu.org/licenses/gpl-3.0.en.html +# ## Usage: ./util/build-debian-package.sh echo "Let's see who read the README.md or not..." diff --git a/util/build.sh b/util/build.sh index 7a47e44..42825db 100755 --- a/util/build.sh +++ b/util/build.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash # Copyright 2021 The Hush Developers -# Released under GPLv3 +# Distributed under the GPLv3 software license, see the accompanying +# file LICENSE or https://www.gnu.org/licenses/gpl-3.0.en.html + +# Purpose: Script to build Hush lightwalletd on x86 64-bit arch # Check if go is installed on system and exits if it is not if ! [ -x "$(command -v go)" ]; then diff --git a/util/build_arm.sh b/util/build_arm.sh new file mode 100755 index 0000000..63ddd79 --- /dev/null +++ b/util/build_arm.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# Copyright 2021 The Hush Developers +# Distributed under the GPLv3 software license, see the accompanying +# file LICENSE or https://www.gnu.org/licenses/gpl-3.0.en.html +# +# Purpose: Script to build the ARM or aarch64 architecture, +# which is what the PinePhone boards are running + +# Check if go is installed on system and exits if it is not +if ! [ -x "$(command -v go)" ]; then + echo 'Error: go is not installed. Install go and try again.' >&2 + exit 1 +fi + +echo "" +echo "Welcome to the Hush magic folks..." +echo "" +echo ".------..------..------..------..------..------..------..------..------..------..------..------." +echo "|L.--. ||I.--. ||G.--. ||H.--. ||T.--. ||W.--. ||A.--. ||L.--. ||L.--. ||E.--. ||T.--. ||D.--. |" +echo "| :/\: || (\/) || :/\: || :/\: || :/\: || :/\: || (\/) || :/\: || :/\: || (\/) || :/\: || :/\: |" +echo "| (__) || :\/: || :\/: || (__) || (__) || :\/: || :\/: || (__) || (__) || :\/: || (__) || (__) |" +echo "| '--'L|| '--'I|| '--'G|| '--'H|| '--'T|| '--'W|| '--'A|| '--'L|| '--'L|| '--'E|| '--'T|| '--'D|" +echo "+------'+------'+------'+------'+------'+------'+------'+------'+------'+------'+------'+------'" + +# now to compiling... +echo "" +echo "You have go installed, so starting to compile Hush lightwalletd for you..." +cd `pwd`/cmd/server +env GOOS=linux GOARCH=arm64 go build -o lightwalletd_aarch64 main.go +mv lightwalletd_aarch64 lightwalletd +mv lightwalletd `pwd`/../../lightwalletd +echo "" +echo "Hush lightwalletd is now compiled for your ARM farm or Pine Rock64. Enjoy and reach out if you need support." +echo "For options, run ./lightwalletd --help" From cded0d4a379160e3fa906a24ee0b1e00239c63cf Mon Sep 17 00:00:00 2001 From: jahway603 Date: Mon, 25 Oct 2021 18:19:55 -0400 Subject: [PATCH 8/9] fixed deb pkg script for ARM --- contrib/debian/control | 2 +- util/build-debian-package-SBC.sh | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/contrib/debian/control b/contrib/debian/control index 1ba4da8..0c3e3d8 100644 --- a/contrib/debian/control +++ b/contrib/debian/control @@ -8,6 +8,6 @@ Vcs-Git: https://git.hush.is/hush/lightwalletd.git Vcs-Browser: https://git.hush.is/hush/lightwalletd Package: lightwalletd -Architecture: amd64 +Architecture: amd64 arm64 Depends: ${shlibs:Depends} Description: Hush lightwallet daemon to run a Silent Dragon Lite server. Speak And Transact Freely. Hush inherits from Bitcoin Protocol and Zcash Protocol and is focused on private communications. diff --git a/util/build-debian-package-SBC.sh b/util/build-debian-package-SBC.sh index c009a14..ffbd5cc 100755 --- a/util/build-debian-package-SBC.sh +++ b/util/build-debian-package-SBC.sh @@ -15,6 +15,20 @@ if ! [ -x "$(command -v ./lightwalletd)" ]; then echo "" exit 1 fi +# Check if lintian is installed and exit if it is not +if ! [ -x "$(command -v lintian)" ]; then + echo 'Error: lintian is not installed yet. Consult your Linux version package manager...' >&2 + echo 'On Debian/Ubuntu, try "sudo apt install lintian"' + echo "" + exit 1 +fi +# Check if fakeroot is installed and exit if it is not +if ! [ -x "$(command -v fakeroot)" ]; then + echo 'Error: fakeroot is not installed yet. Consult your Linux version package manager...' >&2 + echo 'On Debian/Ubuntu, try "sudo apt install fakeroot"' + echo "" + exit 1 +fi # TODO - check that the lightwalletd binary is not x86 and is actually aarch64 @@ -66,7 +80,7 @@ chmod 0755 -R $BUILD_DIR/* # Copy binary cp $SRC_PATH/lightwalletd $DEB_BIN/lightwalletd -#strip $DEB_BIN/lightwalletd # script complained, so comment out... +strip $DEB_BIN/lightwalletd cp $SRC_DEB/changelog $DEB_DOC cp $SRC_DEB/copyright $DEB_DOC cp -r $SRC_DEB/examples $DEB_DOC @@ -79,8 +93,7 @@ gzip --best -n $DEB_MAN/lightwalletd.1 cd $SRC_PATH/contrib # Create the control file -# had to comment line below to move forward in this build script... -#dpkg-shlibdeps $DEB_BIN/lightwalletd +dpkg-shlibdeps $DEB_BIN/lightwalletd dpkg-gencontrol -P$BUILD_DIR -v$DEBVERSION # Create the Debian package @@ -88,7 +101,5 @@ fakeroot dpkg-deb --build $BUILD_DIR cp $BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb $SRC_PATH shasum -a 256 $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb # Analyze with Lintian, reporting bugs and policy violations -# Arch does not have lintian, as it's a Debian package, so commenting this out -# To-DO - test on Debian/Ubuntu, create AUR lintian package -#lintian -i $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb +lintian -i $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb exit 0 From 8881b6f1d6adabbe0fb3328e2ab5678cae37f85f Mon Sep 17 00:00:00 2001 From: jahway603 Date: Wed, 27 Oct 2021 23:33:19 -0400 Subject: [PATCH 9/9] added AUTHORS file --- AUTHORS | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 AUTHORS diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..c33fd49 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,3 @@ +# The Hush Developers + +Jahway603 https://git.hush.is/jahway603 https://github.com/jahway603