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