This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
52 lines (43 loc) · 1.49 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
OUT_ZIP=RHWSL.zip
LNCR_EXE=RHWSL.exe
DLR=curl
DLR_FLAGS=-L
LNCR_URL=https://github.com/yuk7/wsldl/releases/download/22020900/wsldl.exe
all: $(OUT_ZIP)
zip: $(OUT_ZIP)
$(OUT_ZIP): ziproot
@echo -e '\e[1;31mBuilding $(OUT_ZIP)\e[m'
cd ziproot; zip ../$(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:
@echo -e '\e[1;31mExtracting Launcher.exe...\e[m'
$(DLR) $(DLR_FLAGS) $(LNCR_URL) -o Launcher.exe
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
@echo -e '\e[1;31mBuilding rootfs...\e[m'
mkdir rootfs
sudo tar -xpf base.tar -C rootfs
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 chmod +x rootfs
base.tar:
@echo -e '\e[1;31mExporting base.tar using docker...\e[m'
docker run --name rhwsl registry.access.redhat.com/ubi9/ubi:9.1.0-1750 /bin/bash -c "dnf update -y; dnf clean all; pwconv; grpconv; chmod 0744 /etc/shadow; chmod 0744 /etc/gshadow;"
docker export --output=base.tar rhwsl
docker rm -f rhwsl
clean:
@echo -e '\e[1;31mCleaning files...\e[m'
-rm ${OUT_ZIP}
-rm -r ziproot
-rm Launcher.exe
-rm rootfs.tar.gz
-sudo rm -r rootfs
-rm base.tar
-docker rmi registry.access.redhat.com/ubi9/ubi:9.1.0-1750