]> git.sev.monster Git - abchr.git/blame - abchr-newchroot
abchr-newchroot: update package indexes for fetch
[abchr.git] / abchr-newchroot
CommitLineData
9efefcc4 1#!/bin/sh
2set -e
3[ "$(id | awk '{print $1}')" != 'uid=0(root)' ] &&
4 exec sudo "$0" "$(id -u $(whoami))" "$@"
5[ "z$1" = z ] && return 1
6mirror=https://dl-cdn.alpinelinux.org/alpine/edge
7arch="${ABCHR_ARCH:-x86_64}"
b8ed5855 8apk update
9efefcc4 9apk="apk-tools-static-$(apk info apk-tools-static |
10 awk '{if (NR==1) {print substr($1,18)}}').apk"
11dir="$(dirname "$0")/../alpine"
12tmp="$(dirname "$0")/../tmp"
13mkdir -p "$tmp"
14wget -P "$tmp" "$mirror/main/$arch/$apk"
15tar -xvzf "$tmp/$apk" -C "$tmp"
16"$tmp/sbin/apk.static" -UX "$mirror/main" -X "$mirror/community" \
17 --allow-untrusted -p "$dir" --initdb \
18 add busybox busybox-suid libc-utils sudo \
19 alpine-baselayout alpine-conf alpine-release apk-tools \
20 alpine-sdk alpine-repo-tools atools lua-aports
21rm -rf "$tmp"
22cp -Ln /etc/apk/keys/* "$dir/etc/apk/keys"
23cp -f /etc/apk/repositories "$dir/etc/apk/repositories"
24printf -- > "$dir/etc/sudoers.d/abuild" 'abuild ALL=(ALL) NOPASSWD: ALL'
25printf -- >> "$dir/etc/apk/repositories" \
26 '/home/abuild/packages/%s\n' main community testing
27chroot "$dir" /bin/sh -c "adduser -DGabuild -u$1 abuild"
This page took 0.217137 seconds and 4 git commands to generate.