-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui
More file actions
executable file
·51 lines (44 loc) · 1.31 KB
/
gui
File metadata and controls
executable file
·51 lines (44 loc) · 1.31 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
#!/bin/bash
items=()
tagline="Select the following scripts to fix annoying problems with some applications."
if [[ "$(whoami)" != "root" ]]; then
if [ -d "scriptlets" ]; then
cd $(pwd)
else
cd "$HOME/LinuxPatcher"
if [ -d "scriptlets" ]; then
cd $(pwd)
else
cd "$HOME/.techguy16/LinuxPatcher"
fi
fi
WORKDIR=$(pwd)
USERNAME=$(whoami)
fi
parse() {
cd "$2"
while read item; do
item_sel=$(echo "$item" | awk -F"|" '{print $2}')
chmod +x "./scriptlets/${item_sel}.sh"
bash "./scriptlets/${item_sel}.sh" "$3"
done <<< "$1"
}
main() {
content=$(ls scriptlets)
while read item; do
items+=("FALSE" "$(echo $item | sed 's/.sh//g')")
done <<< "$content" #scriptlets/list
selection=$(GDK_BACKEND=x11 yad --title="LinuxPatcher" --list --text="$tagline" \
--column="Select" --column="Name" --checklist "${items[@]}" --width=400 --height=600 --center \
--icon-size="48" --image="computer" --keep-icon-size --image-on-top --compact --button="<b>Execute</b>!go-next:0")
if [[ ! -n "$selection" ]]; then
exit 0
else
pkexec ./gui parse "$(printf "%s|" "$selection")" "$WORKDIR" "$USERNAME"
fi
}
if [[ "$1" == "parse" ]]; then
parse "$2" "$3" "$4"
else
main
fi