[HOWTO] Install Alpine Chroot for armhf/armv7/aarm64/x86

I created a simple script which downloads Alpine linux to a given folder.
This lets you install all Alpine packages on your openrt system.
If you add $PATH and library in profile you dont even need to chroot into alpine since its compiled with musl just like openwrt.

Intallation:
Just prepare some space on any folder and change "INSTALL" & "ARCH" to your corresponding path and platform.
After the installation you can chroot into the path and use it as a normal alpine install.

#!/bin/sh

INSTALL='/opt'
APKTOOLS='2.10.4-r1'
ARCH='aarch64'
MIRROR='http://dl-cdn.alpinelinux.org/alpine'
VER='v3.10'
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
1 Like