-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathJLopt
executable file
·142 lines (138 loc) · 5.17 KB
/
JLopt
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
# ##############################################################################
# ############################### JLIVECD ######################################
# ##############################################################################
# Copyright (c) 2015-2017 Md. Jahidul Hamid
#
# -----------------------------------------------------------------------------
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * The names of its contributors may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# Disclaimer:
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# ##############################################################################
project='JLIVECD'
description='Live CD/DVD customization tool'
version='2.4.5'
bugurl='https://github.com/neurobin/JLIVECD/issues'
author='Md. Jahidul Hamid <[email protected]>'
source='https://github.com/neurobin/JLIVECD'
versioninfo="Name : $project
Description : $description
Version : $version
Author : $author
Source : $source
Bug report : $bugurl"
help="
Run 'JLstart' to start the tool and follow the instructions printed on terminal.
To set/unset options, do optional tweaking and view info about this tool, run 'JLopt'.
JLopt [options]
-v : show version info
-t1 : set primary default terminal
-t2 : set secondary default terminal
-rt1 : factory reset primary terminal
-rt2 : factory reset secondary terminal
-rt : factory reset all terminals
-ra : factory reset all.
-rn : refresh network. Runs JLRefreshNetwork (root)
-t : set timeout
-u : uninstall (root)
-h : show help menu.
"
export JLdir=/usr/local/JLIVECD
cd $JLdir
. ./defconf.sh
. ./funcs.sh
opts=( "$@" )
[[ ${opts[@]} == "" ]] && echo "$help" && exit 0;
#if no argument is passed this for loop will be skipped
skip=false
for ((i=0;i<$#;i++)) do
if $skip;then skip=false;continue;fi
case "${opts[$i]}" in
-v|--version)
echo "$versioninfo"
exit 0;
;;
-rn|--refresh-network)
chkroot
/usr/local/JLIVECD/JLRefreshNetwork
continue
;;
-ra|--reset-all)
echo "" > "$JL_configfile"
continue
;;
-t|--timeout)
timeout="${opts[$((i+1))]}"
[[ $timeout =~ ^[0-9]+$ ]] || { echo "Bad value for timeout: '$timeout'";exit 1; }
timeout=$(echo $timeout |sed "s/^0*\([1-9]\)/\1/;s/^0*$/0/")
update_prop_val "$JL_tmn" "$timeout" "$JL_configfile"
skip=true;
continue
;;
-t1|--terminal1)
terminal1="${opts[$((i+1))]}"
command -v "$terminal1" >/dev/null 2>&1 || { echo "Invalid terminal command: '$terminal1'" ; exit 1; }
update_prop_val "$JL_t1n" "$terminal1" "$JL_configfile"
skip=true;
continue
;;
-t2|--terminal2)
terminal2="${opts[$((i+1))]}"
command -v "$terminal2" >/dev/null 2>&1 || { echo "Invalid terminal command: '$terminal2'" ; exit 1; }
update_prop_val "$JL_t2n" "$terminal2" "$JL_configfile"
skip=true;
continue
;;
-rt1|--reset-terminal1)
echo "$(grep -iv "^[[:blank:]]*$JL_t1n=" "$JL_configfile")" > "$JL_configfile"
continue
;;
-rt2|--reset-terminal2)
echo "$(grep -iv "^[[:blank:]]*$JL_t2n=" "$JL_configfile")" > "$JL_configfile"
continue
;;
-rt|--reset-terminal)
echo "$(grep -iv "^[[:blank:]]*$JL_t1n=" "$JL_configfile")" > "$JL_configfile"
echo "$(grep -iv "^[[:blank:]]*$JL_t2n=" "$JL_configfile")" > "$JL_configfile"
continue
;;
-u|--uninstall)
chkroot
rm -rf "$JLdir" "$JL_logdirtmp" 2>/dev/null
rm /usr/bin/jlstart /bin/JLstart /usr/bin/updarp "$JL_lockF" /usr/share/applications/JLIVECD.desktop /bin/JLopt /usr/bin/jlopt 2>/dev/null
;;
-h|--help)
echo "$help"
exit 0;
;;
*)
echo "$help"
echo "invalid option: '${opts[$i]}'"
exit 1;
;;
esac
done