Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 44 lines (34 sloc) 895 Bytes
#!/bin/sh
set -eu
if [ "$(id -u)" != "0" ]; then
echo "error: must run as root"
exit 1
fi
srv="${1:-/tmp/srv}"
if [ ! -x "$srv" ]; then
echo "error: no $srv"
exit 1
fi
if systemctl is-active --quiet snapd.service snapd.socket; then
echo "error: snapd (or its socket) still active"
exit 1
fi
if [ "${2:-}" ]; then
export SNAPPY_FORCE_CPI_URL="$2"
fi
d=/usr/lib/snapd/snapd
if [ ! -e "${d}.real" ]; then
mv -v "$d" "${d}.real"
trap exit INT
trap 'mv -v "${d}.real" "$d"; exit' EXIT
fi
cp -v "$srv" "$d"
export SNAP_REEXEC=0
export SNAPD_DEBUG="${SNAPD_DEBUG:-1}"
export SNAPD_DEBUG_HTTP="${SNAPD_DEBUG_HTTP:-7}"
export SNAPPY_SQUASHFS_UNPACK_FOR_TESTS="${SNAPPY_SQUASHFS_UNPACK_FOR_TESTS:-0}"
export SNAPPY_TESTING="${SNAPPY_TESTING:-1}"
export SNAP_CONFINE_DEBUG="${SNAP_CONFINE_DEBUG:-1}"
while /usr/lib/snapd/snapd; do
sleep 1 || break
done