Merge pull request 'Version 0.1.1' (#17) from jahway into master
Reviewed-on: https://git.hush.is/hush/lightwalletd/pulls/17
This commit is contained in:
29
Makefile
Normal file
29
Makefile
Normal file
@@ -0,0 +1,29 @@
|
||||
# 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
|
||||
|
||||
# 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 "Cleaning project $(PROJECT_NAME) files..."
|
||||
rm -f $(PROJECT_NAME)
|
||||
rm -rf /tmp/$(PROJECT_NAME)-*
|
||||
@@ -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 |
|
||||
|
||||
16
build.sh
16
build.sh
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2021 The Hush Developers
|
||||
# Released under GPLv3
|
||||
|
||||
# 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
|
||||
|
||||
# now to compiling...
|
||||
cd `pwd`/cmd/server
|
||||
go build -o lightwalletd main.go
|
||||
mv lightwalletd `pwd`/../../lightwalletd
|
||||
echo "lightwalletd is now compiled for you."
|
||||
echo "for options, run ./lightwalletd --help"
|
||||
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"os/signal"
|
||||
@@ -87,8 +88,10 @@ 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.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.")
|
||||
@@ -97,6 +100,12 @@ 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 as a requirement of help2man
|
||||
if len(os.Args) > 1 && (os.Args[1] == "--version" || os.Args[1] == "-v") {
|
||||
fmt.Printf("Hush lightwalletd version " + version + "\n")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// TODO prod metrics
|
||||
// TODO support config from file and env vars
|
||||
flag.Parse()
|
||||
|
||||
32
cmd/server/main_test.go
Normal file
32
cmd/server/main_test.go
Normal file
@@ -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()
|
||||
}
|
||||
5
contrib/debian/changelog
Normal file
5
contrib/debian/changelog
Normal file
@@ -0,0 +1,5 @@
|
||||
lightwalletd (0.1.1) stable; urgency=medium
|
||||
|
||||
* 0.1.1 release.
|
||||
|
||||
-- Hush Core <jahway603@protonmail.com> Sunday, 24 Oct 2021 13:40:30 -0700
|
||||
13
contrib/debian/control
Normal file
13
contrib/debian/control
Normal file
@@ -0,0 +1,13 @@
|
||||
Source: lightwalletd
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: Jahway603 <jahway603@protonmail.com>
|
||||
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.
|
||||
6
contrib/debian/copyright
Normal file
6
contrib/debian/copyright
Normal file
@@ -0,0 +1,6 @@
|
||||
Files: *
|
||||
Copyright: 2019-2021, The Hush developers
|
||||
2018-2019, The Zcash developers
|
||||
License: GPLv3
|
||||
Comment: https://hush.is/developers
|
||||
|
||||
141
contrib/debian/examples/HUSH3.conf
Normal file
141
contrib/debian/examples/HUSH3.conf
Normal file
@@ -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=<addr>
|
||||
|
||||
# Bind to given address and allowlist peers connecting to it. Use [host]:port notation for IPv6
|
||||
#allowbind=<addr>
|
||||
|
||||
##############################################################
|
||||
## 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=<addr>
|
||||
|
||||
# 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
|
||||
|
||||
1
contrib/debian/files
Normal file
1
contrib/debian/files
Normal file
@@ -0,0 +1 @@
|
||||
lightwalletd_0.1.1_amd64.deb utils optional
|
||||
39
contrib/debian/postinst
Normal file
39
contrib/debian/postinst
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
# postinst script for lightwalletd
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <postinst> `configure' <most-recently-configured-version>
|
||||
# * <old-postinst> `abort-upgrade' <new version>
|
||||
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
||||
# <new-version>
|
||||
# * <postinst> `abort-remove'
|
||||
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
||||
# <failed-install-package> <version> `removing'
|
||||
# <conflicting-package> <version>
|
||||
# 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
|
||||
37
contrib/debian/postrm
Normal file
37
contrib/debian/postrm
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
# postrm script for lightwalletd
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <postrm> `remove'
|
||||
# * <postrm> `purge'
|
||||
# * <old-postrm> `upgrade' <new-version>
|
||||
# * <new-postrm> `failed-upgrade' <old-version>
|
||||
# * <new-postrm> `abort-install'
|
||||
# * <new-postrm> `abort-install' <old-version>
|
||||
# * <new-postrm> `abort-upgrade' <old-version>
|
||||
# * <disappearer's-postrm> `disappear' <overwriter>
|
||||
# <overwriter-version>
|
||||
# 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
|
||||
35
contrib/debian/preinst
Normal file
35
contrib/debian/preinst
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
# preinst script for lightwalletd
|
||||
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <new-preinst> `install'
|
||||
# * <new-preinst> `install' <old-version>
|
||||
# * <new-preinst> `upgrade' <old-version>
|
||||
# * <old-preinst> `abort-upgrade' <new-version>
|
||||
# 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
|
||||
38
contrib/debian/prerm
Normal file
38
contrib/debian/prerm
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
# prerm script for lightwalletd
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <prerm> `remove'
|
||||
# * <old-prerm> `upgrade' <new-version>
|
||||
# * <new-prerm> `failed-upgrade' <old-version>
|
||||
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
|
||||
# * <deconfigured's-prerm> `deconfigure' `in-favour'
|
||||
# <package-being-installed> <version> `removing'
|
||||
# <conflicting-package> <version>
|
||||
# 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
|
||||
67
doc/man/lightwalletd.1
Normal file
67
doc/man/lightwalletd.1
Normal file
@@ -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 <https://hush.is/security/>.
|
||||
.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 <https://hush.is/security/>.
|
||||
|
||||
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 <https://www.gnu.org/licenses/gpl-3.0.en.html>.
|
||||
@@ -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,
|
||||
|
||||
98
util/build-debian-package.sh
Executable file
98
util/build-debian-package.sh
Executable file
@@ -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
|
||||
29
util/build.sh
Executable file
29
util/build.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2021 The Hush Developers
|
||||
# Released under GPLv3
|
||||
|
||||
# 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
|
||||
go build -o lightwalletd main.go
|
||||
mv lightwalletd `pwd`/../../lightwalletd
|
||||
echo ""
|
||||
echo "Hush lightwalletd is now compiled for you. Enjoy and reach out if you need support."
|
||||
echo "For options, run ./lightwalletd --help"
|
||||
Reference in New Issue
Block a user