2018-08-30 22:39:24 +00:00
|
|
|
#!/bin/sh -e
|
2019-01-02 08:29:47 +00:00
|
|
|
# Copyright 2019 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
|
|
|
|
url="https://gitlab.com/postmarketOS/pmbootstrap/-/archive/$tag/pmbootstrap-$tag.tar.bz2"
|
|
|
|
pmaports="$(cd $(dirname $0)/..; pwd -P)"
|
|
|
|
|
|
|
|
# Set up depends and binfmt_misc
|
|
|
|
depends="coreutils openssl python3 sudo $@"
|
|
|
|
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
|
|
|
|
wget -q -O "pmb.tar.bz2" "$url"
|
|
|
|
tar -xf "pmb.tar.bz2"
|
|
|
|
mv pmbootstrap-* pmbootstrap
|
|
|
|
|
|
|
|
# Install to $PATH and init
|
|
|
|
ln -s /tmp/pmbootstrap/pmbootstrap.py /usr/local/bin/pmbootstrap
|
|
|
|
echo "Initializing pmbootstrap"
|
|
|
|
su pmos -c "yes '' | pmbootstrap -q --aports '$pmaports' init"
|
|
|
|
echo ""
|