-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodecpy
executable file
·55 lines (45 loc) · 1.03 KB
/
codecpy
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
#!/usr/bin/env bash
[ "$#" -eq 2 ] || [ "$#" -eq 1 ] || {
echo ""
echo "Error args!!!" >&2;
}
if [ ! -b $1 ]; then
echo "Device $1 does not exist";
exit 1;
fi
if [ "$#" -eq 1 ]; then
echo "Device $1 found, removing partitions"
echo "sudo sgdisk -Z $1"
sudo sgdisk -g $1 || exit
echo "sudo sgdisk -o $1"
sudo sgdisk -o $1 || exit
echo ""
echo "Partitioning..."
echo "sudo sgdisk --resize-table=4 -a 1 -n 1:3:20482 -c 1:ssbl -p $1"
sudo sgdisk --resize-table=4 -a 1 -n 1:3:20482 -c 1:ssbl -p $1
echo ""
case "$(uname -s)" in
Linux)
sleep 3
sudo umount $1
;;
*)
echo 'OS not supported'
;;
esac
else
path=$2
echo "Copying bootloader files..."
case "$(uname -s)" in
Linux)
echo "sudo dd if=$path of=${1}"
sudo dd if=$path of=${1}
sleep 1
sudo umount $1
;;
*)
echo 'OS not supported'
;;
esac
fi
echo "Done!"