alpine_chroot.sh
#!/bin/sh
#copied from: https://forum.openwrt.org/t/howto-install-alpine-chroot-for-armhf-armv7-aarm64-x86/38806
 
INSTALL='/opt'
APKTOOLS='2.10.5-r1'
ARCH='armhf'
MIRROR='http://dl-cdn.alpinelinux.org/alpine'
VER='v3.12'
RED='\033[0;31m'
NC='\033[0m'
 
printf "${RED}Downloading Static installer apk...${NC}\n"
wget $MIRROR/$VER/main/$ARCH/apk-tools-static-$APKTOOLS.apk
tar -xzf apk-tools-static-*.apk
rm apk-tools-static-*.apk
rm .PKGINFO
 
 
printf "\n${RED}Installing Base Alpine...${NC}\n"
./sbin/apk.static -X $MIRROR/$VER/main -U --allow-untrusted --root $INSTALL --initdb add alpine-base
rm -r ./sbin/
 
 
 
printf "\n${RED}Adding Repos to chroot${NC}\n"
echo "$MIRROR/$VER/main" > $INSTALL/etc/apk/repositories
echo "$MIRROR/$VER/community" >> $INSTALL/etc/apk/repositories
#echo "http://nl.alpinelinux.org/alpine/edge/testing/" >> $INSTALL/etc/apk/repositories
chroot $INSTALL apk update