2018-08-30 22:39:24 +00:00
|
|
|
#!/bin/sh -e
|
2020-01-06 01:46:56 +00:00
|
|
|
# Copyright 2020 Oliver Smith
|
2018-08-30 22:39:24 +00:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
# usage: install_pmbootstrap.sh [ADDITIONAL_PACKAGE, ...]
|
|
|
|
|
|
|
|
# Config: pmbootstrap tag (or branch)
|
2018-09-05 07:24:36 +00:00
|
|
|
tag="master"
|
2018-08-30 22:39:24 +00:00
|
|
|
|
|
|
|
# Get download URL and pmaports path
|
2020-02-22 20:33:59 +00:00
|
|
|
url="https://gitlab.com/postmarketOS/pmbootstrap.git"
|
2018-08-30 22:39:24 +00:00
|
|
|
pmaports="$(cd $(dirname $0)/..; pwd -P)"
|
|
|
|
|
|
|
|
# Set up depends and binfmt_misc
|
2020-01-12 12:35:23 +00:00
|
|
|
depends="coreutils openssl python3 sudo git $@"
|
2018-08-30 22:39:24 +00:00
|
|
|
echo "Installing dependencies: $depends"
|
|
|
|
apk -q add $depends
|
|
|
|
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
|
|
|
|
|
|
|
|
# Create pmos user
|
|
|
|
echo "Creating pmos user"
|
|
|
|
adduser -D pmos
|
|
|
|
chown -R pmos:pmos .
|
|
|
|
echo 'pmos ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
|
|
|
|
|
|
|
# Download pmbootstrap (to /tmp/pmbootstrap)
|
|
|
|
echo "Downloading pmbootstrap ($tag): $url"
|
|
|
|
cd /tmp
|
2020-02-22 20:33:59 +00:00
|
|
|
git clone -q "$url"
|
|
|
|
git -C pmbootstrap checkout -q "$tag"
|
2018-08-30 22:39:24 +00:00
|
|
|
|
|
|
|
# Install to $PATH and init
|
|
|
|
ln -s /tmp/pmbootstrap/pmbootstrap.py /usr/local/bin/pmbootstrap
|
|
|
|
echo "Initializing pmbootstrap"
|
2020-01-12 12:35:23 +00:00
|
|
|
if ! su pmos -c "yes '' | pmbootstrap -q --aports '$pmaports' --details-to-stdout init"; then
|
2019-01-22 06:02:43 +00:00
|
|
|
echo "ERROR: pmbootstrap init failed!"
|
|
|
|
echo
|
|
|
|
echo "Most likely, this means that pmbootstrap requires a newer"
|
|
|
|
echo "pmaports version. Please rebase on the official pmaports.git"
|
|
|
|
echo "master branch and try again."
|
|
|
|
echo
|
|
|
|
echo "Let us know in the chat or issues if you have trouble with that"
|
|
|
|
echo "and we will be happy to help. Sorry for the inconvenience."
|
|
|
|
echo
|
|
|
|
echo "(If that does not help, click on 'Browse' in the 'Job artifacts'"
|
|
|
|
echo "next to this log output, and have a look at log.txt.)"
|
|
|
|
exit 1
|
|
|
|
fi
|
2018-08-30 22:39:24 +00:00
|
|
|
echo ""
|