Skip to content

Commit f46d098

Browse files
author
buddyjojo
committed
add script
1 parent 26cd82c commit f46d098

File tree

1 file changed

+260
-0
lines changed

1 file changed

+260
-0
lines changed

worli.sh

Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
#!/bin/bash
2+
if [ "$EUID" -ne 0 ]
3+
then echo "this script needs to be ran as root. if your a noob thats 'sudo ./worli.sh'"
4+
exit
5+
fi
6+
echo "WORli, made by JoJo Autoboy#1111"
7+
echo "heavily based off of Mario's wor linux guide: https://www.worproject.ml/guides/how-to-install/from-other-os"
8+
9+
mkdir -p files
10+
mkdir -p files/iso
11+
mkdir -p files/wim
12+
mkdir -p files/isomount
13+
chmod 777 files
14+
chmod 777 files/iso
15+
chmod 777 files/wim
16+
chmod 777 files/isomount
17+
18+
echo " "
19+
echo "prerequisites"
20+
echo " "
21+
echo "- get the windows iso: https://www.worproject.ml/guides/getting-windows-images"
22+
echo " place the windows iso in the files/iso folder then rename it to 'win.iso'"
23+
echo " "
24+
echo "- (NOT RECOMMENDED) if you want use use a custom wim place it in files/wim and rename it to 'install.wim' NOTE: you still need the iso the wim came from in files/iso"
25+
echo " "
26+
echo "- go to https://www.worproject.ml/downloads#windows-on-raspberry-pe-based-installer and download the 'Windows on Raspberry PE-based installer', then place the zip in the 'files' folder and rename it to 'WoR-PE_Package.zip'"
27+
echo " "
28+
echo "- download the latest driver package from: https://github.com/worproject/RPi-Windows-Drivers/releases (get the ZIP archive with the RPi prefix followed by your board version) then place the zip in the files folder and rename it to Windows_ARM64_Drivers.zip"
29+
echo " "
30+
echo "- download the latest UEFI package: (not the source code)"
31+
echo " for Pi 4 and newer: https://github.com/pftf/RPi4/releases"
32+
echo " for Pi 2, 3, CM3: https://github.com/pftf/RPi3/releases"
33+
echo "then place the zip in files and rename it 'UEFI_Firmware.zip'"
34+
echo " "
35+
echo "- If you're using a Raspberry Pi 4, you must update the bootloader to the latest version: https://www.raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md"
36+
37+
if ! command -v wimupdate &> /dev/null
38+
then
39+
echo "- wimtools package not installed. install it (for debian and ubuntu its 'sudo apt install wimtools', for arch it's wimlib)"
40+
exit 1
41+
fi
42+
43+
echo -e "\e[0;31mDO THE PRE STUFF BEFORE CONTINUING\e[0m"
44+
45+
read -p "Press any key to continue..."
46+
47+
echo " "
48+
if [ -f "files/iso/win.iso" ]; then
49+
echo "files/iso/win.iso found"
50+
else
51+
echo "files/iso/win.iso does not exist. abort."
52+
exit 1
53+
fi
54+
55+
if [ -f "files/WoR-PE_Package.zip" ]; then
56+
echo "files/WoR-PE_Package.zip found"
57+
else
58+
echo "files/WoR-PE_Package.zip does not exist. abort."
59+
exit 1
60+
fi
61+
62+
if [ -f "files/Windows_ARM64_Drivers.zip" ]; then
63+
echo "files/Windows_ARM64_Drivers.zip found"
64+
else
65+
echo "files/Windows_ARM64_Drivers.zip does not exist. abort."
66+
exit 1
67+
fi
68+
69+
if [ -f "files/UEFI_Firmware.zip" ]; then
70+
echo "files/UEFI_Firmware.zip found"
71+
else
72+
echo "files/UEFI_Firmware.zip does not exist. abort."
73+
exit 1
74+
fi
75+
echo " "
76+
77+
echo "what /dev/* is your drive? NOTE: all your data on the selected disk will be erased, proceed with caution"
78+
echo "--------------------------------------------------------------------------------------------------------"
79+
80+
parted -l
81+
82+
read -r -p "[/dev/*] eg 'sdb', 'mmcblk0': " disk
83+
84+
echo "you have selected '$disk' is this correct?"
85+
read -r -p "[Y/N]: " input
86+
case $input in
87+
[yY][eE][sS]|[yY])
88+
echo "ok $disk it is"
89+
;;
90+
[nN][oO]|[nN])
91+
echo "abort."
92+
exit 1
93+
;;
94+
*)
95+
echo "Invalid input..."
96+
exit 1
97+
;;
98+
esac
99+
100+
if [[ $disk == *"mmcblk"* ]]; then
101+
export nisk="${disk}p"
102+
else
103+
export nisk="$disk"
104+
fi
105+
106+
echo -e "\e[0;31mWARNING: THE DISK $disk WILL BE WIPED\e[0m do you want to continue?"
107+
read -r -p "[Y/N]: " input
108+
case $input in
109+
[yY][eE][sS]|[yY])
110+
echo "no going back now"
111+
;;
112+
[nN][oO]|[nN])
113+
echo "abort."
114+
exit 1
115+
;;
116+
*)
117+
echo "Invalid input..."
118+
exit 1
119+
;;
120+
esac
121+
122+
echo " "
123+
echo "creating partitions..."
124+
echo " "
125+
126+
echo "ignore the 'not mounted' errors, they are normal"
127+
echo " "
128+
umount /dev/$disk*
129+
130+
parted -s /dev/$disk mklabel gpt
131+
132+
parted -s /dev/$disk mkpart primary 1MB 1000MB
133+
parted -s /dev/$disk set 1 msftdata on
134+
135+
binbowstype() {
136+
echo " "
137+
echo "1: do you want the installer to be able to install Windows on the same drive? (drive needs at least 32 GB)"
138+
echo "2: OR create an installation media that's able to install Windows on other drives? (installation disk needs at least 8 GB, destination drive needs at least 16 GB)"
139+
read -r -p "[1/2]: " input
140+
case $input in
141+
[1])
142+
parted -s /dev/$disk mkpart primary 1000MB 19000MB
143+
parted -s /dev/$disk set 2 msftdata on
144+
return 0
145+
;;
146+
[2])
147+
parted -s -- /dev/$disk mkpart primary 1000MB -0
148+
parted -s /dev/$disk set 2 msftdata on
149+
return 0
150+
;;
151+
*)
152+
echo "Invalid input..."
153+
return 1
154+
;;
155+
esac
156+
}
157+
until binbowstype; do : ; done
158+
159+
sudo mkfs.fat -F 32 /dev/$disk'1'
160+
sudo mkfs.ntfs -f /dev/$disk'2'
161+
162+
mkdir -p /media/bootpart /media/winpart
163+
mount /dev/$nisk'1' /media/bootpart
164+
mount /dev/$nisk'2' /media/winpart
165+
166+
echo " "
167+
echo "copying windows files to the drive, this may take awhile"
168+
echo " "
169+
echo "note: 'WARNING: device write-protected, mounted read-only.' is also normal"
170+
echo " "
171+
172+
mount files/iso/win.iso files/isomount
173+
174+
cp -r files/isomount/boot /media/bootpart
175+
cp -r files/isomount/efi /media/bootpart
176+
mkdir /media/bootpart/sources
177+
cp files/isomount/sources/boot.wim /media/bootpart/sources
178+
179+
if [ -f "files/wim/install.wim" ]; then
180+
cp files/wim/install.wim /media/winpart
181+
else
182+
cp files/isomount/sources/install.wim /media/winpart
183+
fi
184+
185+
umount files/isomount
186+
187+
echo " "
188+
echo "copying the drivers to the drive..."
189+
echo " "
190+
191+
unzip files/WoR-PE_Package.zip -d files/peinstaller
192+
193+
cp -r files/peinstaller/efi /media/bootpart
194+
wimupdate /media/bootpart/sources/boot.wim 2 --command="add files/peinstaller/winpe/2 /"
195+
196+
197+
unzip files/Windows_ARM64_Drivers.zip -d files/driverpackage
198+
wimupdate /media/bootpart/sources/boot.wim 2 --command="add files/driverpackage /drivers"
199+
200+
echo " "
201+
echo "copying the uefi boot files to the drive..."
202+
echo " "
203+
204+
unzip files/UEFI_Firmware.zip -d files/uefipackage
205+
sudo cp files/uefipackage/* /media/bootpart
206+
207+
echo " "
208+
echo "ignore cp: -r not specified; omitting directory ..."
209+
echo " "
210+
211+
piold() {
212+
echo " "
213+
echo -e "are you installing to a Raspberry Pi 2, 3 or CM3?"
214+
echo " "
215+
read -r -p "[Y/N]: " input
216+
case $input in
217+
[yY][eE][sS]|[yY])
218+
dd if=files/peinstaller/pi3/gptpatch.img of=/dev/$disk conv=fsync
219+
return 0
220+
;;
221+
[nN][oO]|[nN])
222+
echo "good, they suck with wor anyways"
223+
return 0
224+
;;
225+
*)
226+
echo "Invalid input..."
227+
return 1
228+
;;
229+
esac
230+
}
231+
until piold; do : ; done
232+
233+
echo " "
234+
echo "unmounting drive, this may also take awhile"
235+
echo " "
236+
237+
echo "again, ignore the 'not mounted' errors, they are normal"
238+
umount /dev/$disk*
239+
240+
241+
echo " "
242+
echo "cleaning up..."
243+
244+
rm -rf files/driverpackage
245+
rm -rf files/uefipackage
246+
rm -rf files/peinstaller
247+
248+
echo " "
249+
echo "Connect the drive and other peripherals to your Raspberry Pi then boot it up."
250+
echo " "
251+
echo "Assuming everything went right in the previous steps, you'll be further guided by the PE-based installer on your Pi."
252+
echo " "
253+
echo "If you've used the first method (self-installation), there's no need to touch the Raspberry Pi once it has booted. The installer will automatically start the installation process after a delay of 15 seconds. Moving the mouse cursor over the Windows Setup window will stop the timer, so you'll have to manually click on the Install button."
254+
echo " "
255+
echo "If you've used the second method (install on a secondary drive), you must also connect the 2nd drive before the installer window opens up, then select it in the drop-down list. Otherwise it will assume you're trying to install Windows on the same drive (self-installation)."
256+
echo " "
257+
258+
echo "all done :)"
259+
exit 1
260+

0 commit comments

Comments
 (0)