Unverified Commit cc6de125 authored by Lorenzo Setale's avatar Lorenzo Setale

adds ipfs-gateway package

parent 87c8c0f6
......@@ -24,7 +24,7 @@ build:ipfs:
- apt-get install --yes make dh-make gpg apt-utils dpkg-dev curl jq dpkg-sig git-crypt
- apt-get install --yes ubuntu-dev-tools binutils-arm-linux-gnueabihf
- dpkg --add-architecture armhf
- make deb_ipfs_amd64 deb_ipfs_arm deb_ipfs-service
- make deb_ipfs_amd64 deb_ipfs_arm deb_ipfs-service deb_ipfs-gateway
artifacts:
paths:
- dist
......
# This file contains quick phony targets to build IPFS packages
IPFS_VERSION:=$(shell curl -s https://dist.ipfs.io/go-ipfs/versions | tail -n 1)
IPFS_PKG_VERSION:=$(shell echo ${IPFS_VERSION} | sed 's/v//')-0
EMAIL ?= "hello@siderus.io"
DEBFULLNAME ?= "Siderus OU"
_prepare_ipfs-gateway_deb:
mkdir -p build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}
cp -aR source/ipfs-gateway.deb/* build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/
@echo "Source: ipfs-gateway" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/control
@echo "Section: misc" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/control
@echo "Priority: optional" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/control
@echo "Maintainer: ${DEBFULLNAME} <${EMAIL}>" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/control
@echo "Build-Depends: debhelper (>= 9)" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/control
@echo "Standards-Version: ${IPFS_PKG_VERSION}" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/control
@echo "" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/control
@echo "Package: ipfs-gateway" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/control
@echo "Depends: ipfs" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/control
@echo "Architecture: all" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/control
@echo "Description: Add system service for IPFS" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/control
# Building the changelog
@echo "ipfs-gateway (${IPFS_PKG_VERSION}) internal; urgency=low" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/changelog
@echo " " >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/changelog
@echo " This package has been built by Siderus using an automation pipeline. Please" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/changelog
@echo " refer to the official go-ipfs changelog for more information" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/changelog
@echo " " >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/changelog
@echo " -- ${DEBFULLNAME} <${EMAIL}> $(shell date -R)" >> build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/changelog
chmod +x build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION}/debian/rules
.PHONY: _prepare_ipfs-gateway_deb
_build_ipfs-gateway_deb_package: _prepare_ipfs-gateway_deb
cd build/deb/all/ipfs-gateway-${IPFS_PKG_VERSION} ;\
dpkg-buildpackage -us -uc -d
.PHONY: ipfs_deb_package
deb_ipfs-gateway:
$(MAKE) clean_build \
_prepare_ipfs-gateway_deb _build_ipfs-gateway_deb_package \
collect_deb_packages
\ No newline at end of file
......@@ -11,7 +11,7 @@ ifeq ($(ARCH),arm)
endif
IPFS_VERSION:=$(shell curl -s https://dist.ipfs.io/go-ipfs/versions | grep -v "rc" | tail -n 1)
IPFS_PKG_VERSION:=$(shell echo ${IPFS_VERSION} | sed 's/v//')-2
IPFS_PKG_VERSION:=$(shell echo ${IPFS_VERSION} | sed 's/v//')-0
EMAIL ?= "hello@siderus.io"
DEBFULLNAME ?= "Siderus OU"
......@@ -48,7 +48,7 @@ _prepare_ipfs_deb: _unpack_ipfs
@echo " simple as the HTTP web, but with permanence built in." >> build/deb/${DEB_ARCH}/ipfs-${IPFS_PKG_VERSION}/debian/control
@echo " You can also mount the world at /ipfs." >> build/deb/${DEB_ARCH}/ipfs-${IPFS_PKG_VERSION}/debian/control
@echo " This package is maintained and distributed by Siderus." >> build/deb/${DEB_ARCH}/ipfs-${IPFS_PKG_VERSION}/debian/control
# Building the changelog
@echo "ipfs (${IPFS_PKG_VERSION}) internal; urgency=low" >> build/deb/${DEB_ARCH}/ipfs-${IPFS_PKG_VERSION}/debian/changelog
@echo " " >> build/deb/${DEB_ARCH}/ipfs-${IPFS_PKG_VERSION}/debian/changelog
......
#!/bin/sh
### BEGIN INIT INFO
# Provides: ipfs-gateway
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts ipfs daemon
# Description: starts go-ipfs daemon using start-stop-daemon
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/ipfs
PIDFILE=/var/run/ipfs-gateway.pid
NAME=ipfs
DESC=ipfs
DAEMON_OPTS=daemon --init --migrate --enable-gc --enable-pubsub-experiment --enable-namesys-pubsub
# Include ipfs defaults if available
if [ -r /etc/default/ipfs ]; then
. /etc/default/ipfs
fi
test -x $DAEMON || exit 0
. /lib/init/vars.sh
. /lib/lsb/init-functions
start_ipfs() {
# Start the daemon/service
#
# Returns:
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_OPTS 2>/dev/null \
|| return 2
}
stop_ipfs() {
# Stops the daemon/service
#
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --pidfile $PIDFILE --name $NAME
RETVAL="$?"
sleep 1
return "$RETVAL"
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
start_ipfs
case "$?" in
0|1) log_end_msg 0 ;;
2) log_end_msg 1 ;;
esac
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
stop_ipfs
case "$?" in
0|1) log_end_msg 0 ;;
2) log_end_msg 1 ;;
esac
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
stop_ipfs
case "$?" in
0|1)
start_ipfs
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
status)
status_of_proc -p $PIDFILE "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
echo "Usage: $NAME {start|stop|restart|status}" >&2
exit 3
;;
esac
\ No newline at end of file
[Unit]
Description=IPFS Daemon for the System by Siderus
Wants=network.target
After=network.target
[Service]
Type=simple
Environment=IPFS_PATH=/var/ipfs/
ExecStart=/usr/bin/ipfs daemon --init --migrate --enable-gc --enable-pubsub-experiment --enable-namesys-pubsub
ExecStop=/usr/bin/pkill -f ipfs
Restart=on-failure
RestartSec=10s
[Install]
WantedBy=multi-user.target
\ No newline at end of file
#!/usr/bin/make -f
%:
dh $@
override_dh_auto_build:
override_dh_auto_install:
override_dh_systemd_enable:
dh_systemd_enable --name=ipfs-gateway
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment