Update peach-go-sbot to be called go-sbot #28
|
@ -1,4 +1,4 @@
|
|||
Package: peach-go-sbot
|
||||
Package: go-sbot
|
||||
Version: {{version}}
|
||||
Architecture: all
|
||||
Maintainer: Andrew Reid <gnomad@cryptolab.net>
|
16
conf/templates/peach_go_sbot/DEBIAN/postinst → conf/templates/go_sbot/DEBIAN/postinst
Executable file → Normal file
16
conf/templates/peach_go_sbot/DEBIAN/postinst → conf/templates/go_sbot/DEBIAN/postinst
Executable file → Normal file
|
@ -2,26 +2,26 @@
|
|||
set -e
|
||||
|
||||
# create user which go-sbot runs as
|
||||
adduser --quiet --system peach-go-sbot
|
||||
id -u peach &>/dev/null || adduser --quiet peach
|
||||
|
||||
# set permissions
|
||||
chown peach-go-sbot /usr/bin/go-sbot
|
||||
chown peach-go-sbot /usr/bin/sbotcli
|
||||
chown peach /usr/bin/go-sbot
|
||||
chown peach /usr/bin/sbotcli
|
||||
|
||||
# Automatically added by cargo-deb
|
||||
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
||||
# This will only remove masks created by d-s-h on package removal.
|
||||
deb-systemd-helper unmask peach-go-sbot.service >/dev/null || true
|
||||
deb-systemd-helper unmask go-sbot.service >/dev/null || true
|
||||
|
||||
# was-enabled defaults to true, so new installations run enable.
|
||||
if deb-systemd-helper --quiet was-enabled peach-go-sbot.service; then
|
||||
if deb-systemd-helper --quiet was-enabled go-sbot.service; then
|
||||
# Enables the unit on first installation, creates new
|
||||
# symlinks on upgrades if the unit file has changed.
|
||||
deb-systemd-helper enable peach-go-sbot.service >/dev/null || true
|
||||
deb-systemd-helper enable go-sbot.service >/dev/null || true
|
||||
else
|
||||
# Update the statefile to add new symlinks (if any), which need to be
|
||||
# cleaned up on purge. Also remove old symlinks.
|
||||
deb-systemd-helper update-state peach-go-sbot.service >/dev/null || true
|
||||
deb-systemd-helper update-state go-sbot.service >/dev/null || true
|
||||
fi
|
||||
fi
|
||||
# End automatically added section
|
||||
|
@ -34,7 +34,7 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-decon
|
|||
else
|
||||
_dh_action=start
|
||||
fi
|
||||
deb-systemd-invoke $_dh_action peach-go-sbot.service >/dev/null || true
|
||||
deb-systemd-invoke $_dh_action go-sbot.service >/dev/null || true
|
||||
fi
|
||||
fi
|
||||
# End automatically added section
|
6
conf/templates/peach_go_sbot/DEBIAN/postrm → conf/templates/go_sbot/DEBIAN/postrm
Executable file → Normal file
6
conf/templates/peach_go_sbot/DEBIAN/postrm → conf/templates/go_sbot/DEBIAN/postrm
Executable file → Normal file
|
@ -8,14 +8,14 @@ fi
|
|||
# Automatically added by cargo-deb
|
||||
if [ "$1" = "remove" ]; then
|
||||
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
||||
deb-systemd-helper mask peach-go-sbot.service >/dev/null || true
|
||||
deb-systemd-helper mask go-sbot.service >/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "purge" ]; then
|
||||
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
||||
deb-systemd-helper purge peach-go-sbot.service >/dev/null || true
|
||||
deb-systemd-helper unmask peach-go-sbot.service >/dev/null || true
|
||||
deb-systemd-helper purge go-sbot.service >/dev/null || true
|
||||
deb-systemd-helper unmask go-sbot.service >/dev/null || true
|
||||
fi
|
||||
fi
|
||||
# End automatically added section
|
2
conf/templates/peach_go_sbot/DEBIAN/prerm → conf/templates/go_sbot/DEBIAN/prerm
Executable file → Normal file
2
conf/templates/peach_go_sbot/DEBIAN/prerm → conf/templates/go_sbot/DEBIAN/prerm
Executable file → Normal file
|
@ -2,6 +2,6 @@
|
|||
set -e
|
||||
# Automatically added by cargo-deb
|
||||
if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
|
||||
deb-systemd-invoke stop peach-go-sbot.service >/dev/null || true
|
||||
deb-systemd-invoke stop go-sbot.service >/dev/null || true
|
||||
fi
|
||||
# End automatically added section
|
|
@ -0,0 +1,15 @@
|
|||
# For details about go-sbot configuration, please visit the repo: https://github.com/cryptoscope/ssb
|
||||
repo = "/home/peach/.ssb-go"
|
||||
debugdir = ""
|
||||
shscap = "1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s="
|
||||
hmac = ""
|
||||
hops = 2
|
||||
lis = "127.0.0.1:8008"
|
||||
wslis = ":8987"
|
||||
debuglis = "localhost:6078"
|
||||
localadv = true
|
||||
localdiscov = true
|
||||
enable_ebt = true
|
||||
promisc = true
|
||||
nounixsock = false
|
||||
repair = true
|
|
@ -1,9 +1,10 @@
|
|||
[Unit]
|
||||
Description=peachs go-sbot
|
||||
Description=peachcloud go-sbot
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=peach-go-sbot
|
||||
User=peach
|
||||
Environment="LIBRARIAN_WRITEALL=0"
|
||||
ExecStart=/usr/bin/go-sbot
|
||||
Restart=always
|
||||
|
|
@ -14,15 +14,15 @@ from peach_package_builder.constants import *
|
|||
from peach_package_builder.utils import render_template, add_deb_to_freight, update_freight_cache
|
||||
|
||||
# manually update this version when we want to build a new peach-go-sbot package
|
||||
PEACH_GO_SBOT_VERSION = '0.1.4'
|
||||
GO_SBOT_VERSION = '0.1.24'
|
||||
|
||||
# constants
|
||||
DEB_CONF_DIR = os.path.join(PROJECT_PATH, 'conf/templates/peach_go_sbot')
|
||||
DEB_BUILD_DIR = "/tmp/peach_go_sbot"
|
||||
DEB_CONF_DIR = os.path.join(PROJECT_PATH, 'conf/templates/go_sbot')
|
||||
DEB_BUILD_DIR = "/tmp/go_sbot"
|
||||
GO_SSB_DIR = "/srv/peachcloud/automation/go-ssb"
|
||||
|
||||
|
||||
def crosscompile_peach_go_sbot():
|
||||
def crosscompile_go_sbot():
|
||||
subprocess.check_call(["git", "pull"], cwd=GO_SSB_DIR)
|
||||
print("[CROSS-COMPILING sbotcli]")
|
||||
subprocess.check_call(["env", "GOOS=linux", "GOARCH=arm64", "go", "build", "./cmd/sbotcli"], cwd=GO_SSB_DIR)
|
||||
|
@ -30,8 +30,8 @@ def crosscompile_peach_go_sbot():
|
|||
subprocess.check_call(["env", "GOOS=linux", "GOARCH=arm64", "go", "build", "./cmd/go-sbot"], cwd=GO_SSB_DIR)
|
||||
|
||||
|
||||
def package_peach_go_sbot(version):
|
||||
print("[ PACKAGING peach-go-sbot ]")
|
||||
def package_go_sbot(version):
|
||||
print("[ PACKAGING go-sbot ]")
|
||||
# copy debian conf files into correct locations in package build directory
|
||||
DEBIAN_SRC_DIR = os.path.join(DEB_CONF_DIR, 'DEBIAN')
|
||||
DEBIAN_DEST_DIR = os.path.join(DEB_BUILD_DIR, 'DEBIAN')
|
||||
|
@ -43,7 +43,7 @@ def package_peach_go_sbot(version):
|
|||
shutil.copyfile(src, dest)
|
||||
subprocess.check_call(["chmod", "775", dest])
|
||||
# copy control file putting in correct version number
|
||||
src = os.path.join("peach_go_sbot/DEBIAN/control")
|
||||
src = os.path.join("go_sbot/DEBIAN/control")
|
||||
dest = os.path.join(DEBIAN_DEST_DIR, "control")
|
||||
render_template(src=src, dest=dest, template_vars={"version": version})
|
||||
|
||||
|
@ -51,8 +51,16 @@ def package_peach_go_sbot(version):
|
|||
SERVICE_DIR = os.path.join(DEB_BUILD_DIR, 'lib/systemd/system')
|
||||
os.makedirs(SERVICE_DIR)
|
||||
shutil.copyfile(
|
||||
os.path.join(DEB_CONF_DIR, 'peach-go-sbot.service'),
|
||||
os.path.join(SERVICE_DIR, 'peach-go-sbot.service')
|
||||
os.path.join(DEB_CONF_DIR, 'go-sbot.service'),
|
||||
os.path.join(SERVICE_DIR, 'go-sbot.service')
|
||||
)
|
||||
|
||||
# copy go-sbot config.toml
|
||||
SBOT_CONFIG_DIR = os.path.join(DEB_BUILD_DIR, 'home/peach/.ssb-go')
|
||||
os.makedirs(SBOT_CONFIG_DIR)
|
||||
shutil.copyfile(
|
||||
os.path.join(DEB_CONF_DIR, 'config.toml'),
|
||||
os.path.join(SBOT_CONFIG_DIR, 'config.toml')
|
||||
)
|
||||
|
||||
# copy cross-compiled binaries
|
||||
|
@ -68,7 +76,7 @@ def package_peach_go_sbot(version):
|
|||
subprocess.check_call(["chmod", "770", destination])
|
||||
|
||||
# create deb package
|
||||
deb_file_name = "peach-go-sbot_{}_arm64.deb".format(version)
|
||||
deb_file_name = "go-sbot_{}_arm64.deb".format(version)
|
||||
print("[ CREATING {}]".format(deb_file_name))
|
||||
subprocess.check_call(["dpkg-deb", "-b", ".", deb_file_name], cwd=DEB_BUILD_DIR)
|
||||
|
||||
|
@ -83,22 +91,22 @@ def package_peach_go_sbot(version):
|
|||
update_freight_cache()
|
||||
|
||||
|
||||
def build_peach_go_sbot():
|
||||
def build_go_sbot():
|
||||
|
||||
# gets the most recently built peach_go_sbot version, and increments the micro-number by 1
|
||||
version = PEACH_GO_SBOT_VERSION
|
||||
print("[ BUILDING PEACH-GO-SBOT VERSION {}]".format(version))
|
||||
# gets the most recently built go_sbot version, and increments the micro-number by 1
|
||||
version = GO_SBOT_VERSION
|
||||
print("[ BUILDING GO-SBOT VERSION {}]".format(version))
|
||||
|
||||
# delete build directory if it already exists or create it
|
||||
subprocess.check_call(["rm", "-rf", DEB_BUILD_DIR])
|
||||
if not os.path.exists(DEB_BUILD_DIR):
|
||||
os.makedirs(DEB_BUILD_DIR)
|
||||
|
||||
# cross-compile and package peach-go-sbot with new version number
|
||||
crosscompile_peach_go_sbot()
|
||||
package_peach_go_sbot(version=version)
|
||||
# cross-compile and package go-sbot with new version number
|
||||
crosscompile_go_sbot()
|
||||
package_go_sbot(version=version)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
build_peach_go_sbot()
|
||||
build_go_sbot()
|
||||
|
Loading…
Reference in New Issue