Skip to content

Commit 865f4e1

Browse files
authored
Add batch script for downloading and combining ISO from Windows (#176)
1 parent a87bfda commit 865f4e1

2 files changed

Lines changed: 104 additions & 0 deletions

File tree

.github/workflows/CI.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ jobs:
116116
sudo sed -i 's/GITHUBRELEASE/v${{ env.isotag }}/g' ${{ github.workspace }}/.github/workflows/iso.sh
117117
sudo cp ${{ github.workspace }}/.github/workflows/iso.sh ${{ github.workspace }}/output/iso.sh
118118
119+
sudo sed -i 's/GITHUBRELEASE/v${{ env.isotag }}/g' ${{ github.workspace }}/.github/workflows/iso.bat
120+
sudo cp ${{ github.workspace }}/.github/workflows/iso.bat ${{ github.workspace }}/output/iso.bat
121+
119122
- name: Release
120123
if: github.ref == 'refs/heads/LTS'
121124
uses: softprops/action-gh-release@v2

.github/workflows/iso.bat

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
@ECHO off
2+
3+
SET latest=GITHUBRELEASE
4+
SET latestkver=%latest%
5+
CALL SET latestkver=%%latestkver:v=%%
6+
FOR /f "tokens=1,2 delims=-" %%a IN ("%latestkver%") DO (
7+
SET latestkver=%%a
8+
)
9+
10+
SET downloads=%userprofile%\Downloads
11+
12+
ECHO Choose the flavour of Ubuntu you wish to install:
13+
ECHO.
14+
ECHO 1. Ubuntu
15+
ECHO 2. Kubuntu
16+
ECHO 3. Ubuntu Unity
17+
ECHO.
18+
SET /P flavinput=Type your choice (1, 2 etc.) from the above list and press return.
19+
20+
IF "%flavinput%"=="1" (
21+
SET flavour=ubuntu
22+
) ELSE (
23+
IF "%flavinput%"=="2" (
24+
SET flavour=kubuntu
25+
) ELSE (
26+
IF "%flavinput%"=="3" (
27+
SET flavour=ubuntu-unity
28+
) ELSE (
29+
ECHO Invalid input. Aborting!
30+
PAUSE
31+
EXIT
32+
)
33+
)
34+
)
35+
36+
ECHO Choose the version of Ubuntu you wish to install:
37+
ECHO.
38+
ECHO 1. 24.04 LTS - Noble Numbat
39+
ECHO 2. 25.10 - Questing Quokka
40+
ECHO.
41+
SET /P verinput=Type your choice (1 or 2) from the above list and press return.
42+
43+
IF "%verinput%"=="1" (
44+
SET iso=%flavour%-24.04-%latestkver%-t2-noble
45+
SET ver=24.04 LTS - Noble Numbat
46+
) ELSE (
47+
IF "%verinput%"=="2" (
48+
SET iso=%flavour%-25.10-%latestkver%-t2-questing
49+
SET ver=25.10 - Questing Quokka
50+
) ELSE (
51+
ECHO "Invalid input. Aborting!"
52+
PAUSE
53+
EXIT
54+
)
55+
)
56+
57+
ECHO Downloading Part 1 for %flavour% %ver%
58+
curl -#L https://github.com/t2linux/T2-Ubuntu/releases/download/%latest%/%iso%.iso.00 > %downloads%\%iso%.iso
59+
60+
ECHO Downloading Part 2 for %flavour% %ver%
61+
curl -#L https://github.com/t2linux/T2-Ubuntu/releases/download/%latest%/%iso%.iso.01 >> %downloads%\%iso%.iso
62+
63+
ECHO Downloading Part 3 for %flavour% %ver%
64+
curl -#L https://github.com/t2linux/T2-Ubuntu/releases/download/%latest%/%iso%.iso.02 >> %downloads%\%iso%.iso
65+
66+
FOR /f "tokens=1,2 delims= " %%a IN ("%ver%") DO (
67+
SET shortver=%%a
68+
)
69+
70+
curl -s -L https://github.com/t2linux/T2-Ubuntu/releases/download/%latest%/sha256-%flavour%-%shortver% -o shafile.txt
71+
72+
FOR /F "DELIMS=" %%A IN (shafile.txt) DO (
73+
SET actual_iso_chksum=%%A
74+
GOTO :break_loop
75+
)
76+
:break_loop
77+
78+
DEL shafile.txt
79+
80+
FOR /f "tokens=1,2 delims= " %%a IN ("%actual_iso_chksum%") DO (
81+
SET actual_iso_chksum=%%a
82+
)
83+
84+
ECHO Verifying sha256 checksums
85+
86+
FOR /f "tokens=1" %%i IN ('certutil -hashfile %downloads%\%iso%.iso SHA256 ^| findstr /v "hash"') DO (
87+
SET "downloaded_iso_chksum=%%i"
88+
)
89+
90+
ECHO %actual_iso_chksum%
91+
ECHO %downloaded_iso_chksum%
92+
93+
IF "%actual_iso_chksum%" NEQ "%downloaded_iso_chksum%" (
94+
ECHO Error: Failed to verify sha256 checksums of the ISO
95+
PAUSE
96+
EXIT
97+
)
98+
99+
ECHO ISO saved successfully
100+
101+
PAUSE

0 commit comments

Comments
 (0)