This repository was archived by the owner on Nov 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcheckisowriter
More file actions
executable file
·63 lines (46 loc) · 2.13 KB
/
checkisowriter
File metadata and controls
executable file
·63 lines (46 loc) · 2.13 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
#!/bin/bash
# === This file is part of IsoWriter - <http://github.com/kaosx/isowriter> ===
#
# Copyright 2016-2017, Anke Boersma demm@kaosx.us>
#
# IsoWriter is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IsoWriter is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with IsoWriter. If not, see <http://www.gnu.org/licenses/>.
#
# alias GETTEXT='gettext "checkisowriter"'
# GETTEXT='gettext "checkisowriter"'
# po files commands:
# xgettext -o po/checkisowriter.pot -L Shell checkisowriter
# msgfmt -v checkisowriter-nl_NL.po -o nl_NL.mo
. gettext.sh
TEXTDOMAIN=checkisowriter
export TEXTDOMAIN
TEXTDOMAINDIR=/usr/share/locale
export TEXTDOMAINDIR
kdialog --msgbox "$(gettext "Verifying the integrity of the USB in comparison to<br> the downloaded ISO, this can take a few minutes")"
CheckedFile=$(cat /tmp/iso.txt)
echo ${CheckedFile}
UsbDevice=$(blkid | grep iso9660 | head -c 8)
if [ ! ${UsbDevice} ]; then
kdialog --msgbox "$(gettext "No Flash USB detected.")"
else
sha256=$(sha256sum ${CheckedFile} | head -c 64)
bites=$(wc -c ${CheckedFile} | awk '{print $1;}')
usb=$(pkexec /usr/bin/head -c ${bites} ${UsbDevice} | sha256sum | head -c 64)
if [ ${sha256} == ${usb} ]; then
kdialog --msgbox "$(gettext "The downloaded ISO file and USB write match.<br><br>
sha256sum for both is:<br><b>${sha256}</b><br><br>Make sure to verify against the sha256sum of the source where you downloaded the ISO from.")"
fi
if [ ${sha256} != ${usb} ]; then
kdialog --error "$(gettext "ISO files do not match, do not use this USB for install media. <br><br> Or make sure only one USB flash device is connected and run Verify again.")"
fi
fi