forked from masteor/ManjaroWSL2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (55 loc) · 3.44 KB
/
Makefile
File metadata and controls
65 lines (55 loc) · 3.44 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
OUT_ZIP=ManjaroWSL2.zip
LNCR_EXE=Manjaro.exe
DLR=curl
DLR_FLAGS=-L
LNCR_ZIP_URL=https://github.com/yuk7/wsldl/releases/download/`curl https://api.github.com/repos/yuk7/wsldl/releases/latest -s | jq .name -r`/icons.zip
LNCR_ZIP_EXE=Manjaro.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'
unzip 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 bsdtar -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 bsdtar -zxpf 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 > /dev/null
sudo cp wsl.conf rootfs/etc/wsl.conf
sudo cp wsl-distribution.conf rootfs/etc/wsl-distribution.conf
sudo cp manjaro.ico rootfs/usr/lib/wsl/manjaro.ico
sudo cp -f setcap-iputils.hook rootfs/etc/pacman.d/hooks/50-setcap-iputils.hook
sudo cp bash_profile rootfs/root/.bash_profile
sudo cp wslg-init.service rootfs/usr/lib/systemd/system/wslg-init.service
sudo chmod +x rootfs
base.tar:
@echo -e '\e[1;31mExporting base.tar using docker...\e[m'
docker run --net=host --ulimit nofile=1024:10240 --name manjarowsl manjarolinux/base:latest /bin/bash -c "pacman-mirrors --fasttrack 5; rm -rf /etc/pacman.d/gnupg; pacman-key --init; pacman-key --populate; sed -ibak -e 's/#Color/Color/g' -e 's/CheckSpace/#CheckSpace/g' /etc/pacman.conf; sed -ibak -e 's/IgnorePkg/#IgnorePkg/g' /etc/pacman.conf; sed -i 's/#\[multilib\]/\[multilib\]/g' /etc/pacman.conf; sed -i '/\[multilib\]/ { n; s/#Include/Include/; }' /etc/pacman.conf; pacman --noconfirm --needed -Sy archlinux-keyring manjaro-keyring; pacman --noconfirm -Syyu; pacman --noconfirm --needed -Sy aria2 aspell base-devel bc btop ccache dconf dbus dnsutils dos2unix fastfetch fontconfig figlet git grep hspell hunspell hwdata inetutils iputils iproute2 jq keychain libva-mesa-driver libva-utils libxcrypt-compat libvoikko linux-tools lolcat lzop nano ntp nuspell ncurses openssh pamac-cli pngcrush procps socat sudo ttf-dejavu usbutils unzip wget xdg-utils xmlto yay yelp-tools; mkdir -p /etc/pacman.d/hooks; echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel; sed -i 's/#es_MX.UTF-8 UTF-8/es_MX.UTF-8 UTF-8/g' /etc/locale.gen && locale-gen; systemd-machine-id-setup; rm /var/lib/dbus/machine-id; dbus-uuidgen --ensure=/etc/machine-id; dbus-uuidgen --ensure; yes | LC_ALL=es_MX.UTF-8 pacman -Scc; mkdir -p /usr/lib/wsl; echo 'EDITOR=nano' > /etc/environment; echo 'VISUAL=nano' >> /etc/environment; echo \"alias vi='nano'\" >> /etc/bash.bashrc; echo \"alias vim='nano'\" >> /etc/bash.bashrc; git config --global core.editor nano"
docker export --output=base.tar manjarowsl
docker rm -f manjarowsl
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
-sudo rm -r rootfs
-rm base.tar
-docker rmi manjarolinux/base:latest -f