-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer
executable file
·143 lines (132 loc) · 3.82 KB
/
installer
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/bash
progname="mkusb-plug"
########################################################################
function test_host {
LANG=C lsblk > /dev/null
if [ $? -ne 0 ]
then
echo "
*** This operating system is too old, there is no 'lsblk' ***
"
lsb_release -a 2> /dev/null
echo "
Try mkusb-bas"
exit 1
fi
LANG=C dd --help|grep 'progress.*stat' > /dev/null
if [ $? -ne 0 ]
then
echo "*** This operating system is too old for how '$progname' uses 'dd' ***"
lsb_release -a 2> /dev/null
echo "- If you want to create a persistent live drive, try
- mkusb version 12 alias mkusb-dus: with or without a GUI
- mkusb-minp: text mode and persistence for Ubuntu 19.10+ and Debian 10+
These programs must be installed from separate sources.
- If you want to use the plug-in method, try
- xorriso-dd-target: text mode, cloning, tips:
xorriso-dd-target -help | less
xorriso-dd-target -with_sudo -plug_test
xorriso-dd-target -with_sudo -plug_test -look_for_iso
xorriso-dd-target -with_sudo -plug_test -image_file mini.iso -dummy_force
xorriso-dd-target -with_sudo -plug_test -look_for_iso -image_file mini.iso -dummy_force
- If the operating system is too old, you may have to
- unmount the partitions on the target drive manually
- override the warnings and copy & paste the suggested command lines
because lsblk does not provide the all info that xorriso-dd-target wants.
"
read -p "Do you want to install 'xorriso-dd-target' from this tarball? (y/N) " ans
if [ "$ans" == "y" ]
then
cp -iv xorriso-dd-target /usr/local/bin
fi
exit 1
fi
}
########################################################################
# main
########################################################################
if [ "$(whoami)" != "root" ]
then
echo "run as root or with sudo"
exit 1
fi
if [ $# -eq 0 ]
then
echo "Usage: sudo $0 i # install mkusb-plug"
echo " sudo $0 r # remove mkusb-plug"
exit
elif [ "$1" == "i" ] || [ "$1" == "-i" ]
then
test_host
echo "installing mkusb-plug ..."
cp -iv mkusb-plug xorriso-dd-target watch-flush /usr/local/bin
cp -iv mkusb-sedd mkusb-tow /usr/local/sbin
mkdir -p /usr/share/icons/hicolor/48x48/apps/
cp -iv mkusb.png /usr/share/icons/hicolor/48x48/apps/
mkdir -p /usr/share/mkusb
cp -iv plug-start grub-win-ntfs-install.img.xz /usr/share/mkusb
mkdir -p /usr/share/applications
cp -iv mkusb-plug.desktop /usr/share/applications
tmpstr=$(which zenity)
if [ "$tmpstr" == "" ]
then
apt update && apt install zenity
fi
tmpstr=$(which pv)
if [ "$tmpstr" == "" ]
then
apt update && apt install pv
fi
tmpstr=$(which partprobe)
if [ "$tmpstr" == "" ]
then
apt update && apt install parted
fi
tmpstr=$(which expect)
if [ "$tmpstr" == "" ]
then
tmpst2=$(lsb_release -a|grep -im1 'buntu')
if [ "$tmpst2" != "" ]
then
add-apt-repository universe
fi
apt update && apt install expect
fi
tmpstr=$(which xterm)
if [ "$tmpstr" == "" ]
then
tmpst2=$(lsb_release -a|grep -im1 'buntu')
if [ "$tmpst2" != "" ]
then
add-apt-repository universe
fi
apt update && apt install xterm
fi
tmpstR=$(which mkfs.vfat)
tmpstS=$(which mkfs.exfat)
tmpstT=$(which mkfs.ntfs)
if [ "$tmpstR" == "" ] || [ "$tmpstS" == "" ] || [ "$tmpstT" == "" ]
then
tmpst2=$(lsb_release -a|grep -im1 'buntu')
if [ "$tmpst2" != "" ]
then
add-apt-repository universe
fi
apt update && apt install dosfstools ntfs-3g exfat-fuse exfat-utils
fi
elif [ "$1" == "r" ] || [ "$1" == "-r" ]
then
echo "removing mkusb-plug ..."
rm -i /usr/local/bin/{mkusb-plug,xorriso-dd-target,watch-flush}
rm -i /usr/local/sbin/{mkusb-sedd,mkusb-tow}
rm -i /usr/share/applications/mkusb-plug.desktop
rm -i /usr/share/mkusb/{plug-start,grub-win-ntfs-install.img.xz}
if test -f /usr/local/sbin/mkusb-minp
then
rm -i /usr/local/sbin/mkusb-minp
fi
if test -f /usr/local/bin/mkusb-plug-nox
then
rm -i /usr/local/bin/mkusb-plug-nox
fi
fi