runit-artifacts.sh 1.53 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
#!/bin/sh

#
# Builds the artifacts required for runit on Alpine. It's already
# a package so not worrying about it currently
#

set -x

if [ -n "$DESTDIR" ]; then
    export DESTDIR="$DESTDIR/runit"
    mkdir -p $DESTDIR
fi

DIRNAME=`pwd`

$DIRNAME/alpine/prepare.sh

apk update

apk add alpine-sdk wget
cd /tmp
if [ -z "$RUNITSRC" ]; then
    apk add git ca-certificates
    git clone https://gitlab.flux.utah.edu/emulab/runit runit
    # will need to be removed once alpine branch merged with master
    # cd runit/
    # git checkout alpine
    # cd ..
else
    mkdir -p runit
    cp -pR $RUNITSRC/* runit
fi

cd runit/alpine/

mkdir -p /var/cache/distfiles
adduser -D packager
addgroup packager abuild
chgrp abuild /var/cache/distfiles
chgrp -R abuild ..
chmod -R g+w ..
chmod g+w /var/cache/distfiles
echo "packager    ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

sudo -u packager sh $DIRNAME/alpine3/runit-packager.sh

cd /tmp/runit/x86_64
49 50 51 52
mkdir -p $DESTDIR/tmp
chmod root:root $DESTDIR/tmp
chmod 1777 $DESTDIR/tmp
cp -p *.apk $DESTDIR/tmp
53 54

# cd ../..
55
# cp -p *.deb $DESTDIR/tmp
56 57
# rm -rf runit *.deb *.dsc

58 59 60 61 62 63 64 65 66 67 68 69
#
# Also rebuild shadow to support user/group names with capitalized letters.
#
cd /tmp/
wget https://www.emulab.net/downloads/alpine-shadow-src.tar.gz
tar -xzvf alpine-shadow-src.tar.gz
chown -R packager shadow
cd shadow
sudo -u packager abuild checksum
sudo -u packager -H abuild -r
cp -p /home/packager/packages/tmp/x86_64/shadow-4*.apk \
    /home/packager/packages/tmp/x86_64/shadow-uidmap-4*.apk \
70
    $DESTDIR/tmp
71

72 73 74
$DIRNAME/alpine/cleanup.sh

exit 0