]> git.sev.monster Git - abchr.git/blame_incremental - abchr-newchroot
apkgvers: replace grep/sed with awk
[abchr.git] / abchr-newchroot
... / ...
CommitLineData
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}"
8apk update
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.037548 seconds and 5 git commands to generate.