some-usable-scripts/mk/alpine.mk

30 lines
740 B
Makefile
Raw Normal View History

2024-08-24 10:49:50 +02:00
CHROOT ?= /tmp/root
ARCH ?= x86_64
VERSION ?= v3.20
MIRROR ?= http://uk.alpinelinux.org/alpine/
URL_REPOS ?= $(MIRROR)$(VERSION)
2024-08-24 10:53:43 +02:00
enter:
2024-08-24 10:49:50 +02:00
chroot $(CHROOT) /bin/sh
2024-08-24 10:53:43 +02:00
install:
2024-08-24 10:49:50 +02:00
@echo "creating a new alpine $(VERSION) chroot"
mkdir -p $(CHROOT)
apk --arch $(ARCH) -X $(URL_REPOS)/main/ -U --allow-untrusted --root $(CHROOT) --initdb add alpine-base
cp /etc/resolv.conf $(CHROOT)/etc/
echo "$(URL_REPOS)/main" > $(CHROOT)/etc/apk/repositories
echo "$(URL_REPOS)/community" >> $(CHROOT)/etc/apk/repositories
2024-08-24 10:53:43 +02:00
mount:
2024-08-24 10:49:50 +02:00
for a in proc sys dev; do mount -o bind /$$a $(CHROOT)/$$a; done
2024-08-24 10:53:43 +02:00
unmount:
2024-08-24 10:49:50 +02:00
-umount $(CHROOT)/proc
-umount $(CHROOT)/sys
-umount $(CHROOT)/dev
2024-08-24 10:53:43 +02:00
delete: unmount
2024-08-24 10:49:50 +02:00
rm -r $(CHROOT)
2024-08-24 10:53:43 +02:00
new: install mount enter