mirror of
https://github.com/yuk7/AlpineWSL.git
synced 2026-01-19 00:57:21 +01:00
71 lines
2.1 KiB
Makefile
71 lines
2.1 KiB
Makefile
OUT_ZIP=Alpine.zip
|
|
LNCR_EXE=Alpine.exe
|
|
|
|
DLR=curl
|
|
DLR_FLAGS=-L
|
|
BASE_URL=https://dl-cdn.alpinelinux.org/alpine/v3.21/releases/x86_64/alpine-minirootfs-3.21.3-x86_64.tar.gz
|
|
ROOTFS_TARBALL_CKSM_URL=${BASE_URL}.sha512
|
|
LNCR_ZIP_URL=https://github.com/yuk7/wsldl/releases/download/25030400/icons.zip
|
|
LNCR_ZIP_EXE=Alpine.exe
|
|
|
|
all: $(OUT_ZIP)
|
|
|
|
zip: $(OUT_ZIP)
|
|
$(OUT_ZIP): ziproot
|
|
@echo -e '\e[1;31mBuilding $(OUT_ZIP)\e[m'
|
|
cd ziproot; bsdtar -a -cf ../$(OUT_ZIP) *
|
|
|
|
ziproot: Launcher.exe rootfs.tar.gz
|
|
@echo -e '\e[1;31mBuilding ziproot...\e[m'
|
|
mkdir ziproot
|
|
cp Launcher.exe ziproot/${LNCR_EXE}
|
|
cp rootfs.tar.gz ziproot/
|
|
|
|
exe: Launcher.exe
|
|
Launcher.exe: icons.zip
|
|
@echo -e '\e[1;31mExtracting Launcher.exe...\e[m'
|
|
bsdtar -xvf icons.zip $(LNCR_ZIP_EXE)
|
|
mv $(LNCR_ZIP_EXE) Launcher.exe
|
|
|
|
icons.zip:
|
|
@echo -e '\e[1;31mDownloading icons.zip...\e[m'
|
|
$(DLR) $(DLR_FLAGS) $(LNCR_ZIP_URL) -o icons.zip
|
|
|
|
rootfs.tar.gz: rootfs
|
|
@echo -e '\e[1;31mBuilding rootfs.tar.gz...\e[m'
|
|
cd rootfs; sudo tar -zcpf ../rootfs.tar.gz `sudo ls`
|
|
sudo chown `id -un` rootfs.tar.gz
|
|
|
|
rootfs: base.tar.gz profile
|
|
@echo -e '\e[1;31mBuilding rootfs...\e[m'
|
|
mkdir rootfs
|
|
sudo tar -zxpf base.tar.gz -C rootfs
|
|
sudo cp -f /etc/resolv.conf rootfs/etc/resolv.conf
|
|
sudo cp -f profile rootfs/etc/profile
|
|
sudo chroot rootfs /sbin/apk update
|
|
sudo chroot rootfs /sbin/apk add bash
|
|
echo "# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line." | sudo tee rootfs/etc/resolv.conf
|
|
sudo rm -rf `sudo find rootfs/var/cache/apk/ -type f`
|
|
sudo chmod +x rootfs
|
|
|
|
base.tar.gz:
|
|
@echo -e '\e[1;31mDownloading base.tar.gz...\e[m'
|
|
$(DLR) $(DLR_FLAGS) $(BASE_URL) -o base.tar.gz
|
|
$(DLR) $(DLR_FLAGS) $(ROOTFS_TARBALL_CKSM_URL) -o base.tar.gz.sha512sum.txt
|
|
if ! (head -c 128 < base.tar.gz.sha512sum.txt; echo " base.tar.gz") | shasum -c; then \
|
|
echo 'Checksum failed.'; \
|
|
rm base.tar.gz base.tar.gz.sha512sum.txt; \
|
|
exit 1; \
|
|
fi
|
|
|
|
clean:
|
|
@echo -e '\e[1;31mCleaning files...\e[m'
|
|
-rm ${OUT_ZIP}
|
|
-rm -r ziproot
|
|
-rm Launcher.exe
|
|
-rm icons.zip
|
|
-rm rootfs.tar.gz
|
|
-rm rootfs.tar.gz.sha512sum.txt
|
|
-sudo rm -r rootfs
|
|
-rm base.tar.gz
|