-
Notifications
You must be signed in to change notification settings - Fork 0
/
sideload-browser
executable file
·129 lines (84 loc) · 4.12 KB
/
sideload-browser
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
#!/bin/bash
source sideloader-config
osCheck
versionCheck
packageCheck
while test $# -gt 0; do
case "$1" in
--nogui)
NOGUI=1
shift
;;
*)
break
;;
esac
done
SELECTION=$HOME
MOUNTSUCCESS=false
#check already mounted set $MOUNTSUCCESS
if [ "$(ls -A $MNTLOC/ 2>/dev/null)" ]; then
MOUNTSUCCESS=true
SELECTION=$MNTLOC
ok "Drive mounted at: $MNTLOC ($(ls $MNTLOC | wc -l) folders available)\n\n"
fi
# if not $MOUNTSUCCESS, ask
[ -z $CI ] && [[ $MOUNTSUCCESS == false ]] && dialog --title "Continue?" --yesno "Would you like to mount the drive directly? [!BETA!]" 0 0
if [ $? = 0 ]; then
sideload-mount mount && SELECTION=$MNTLOC
fi
[ "$MOUNTSUCCESS" == false ] && EXTRALINE="Having_trouble_mounting_the_drive???"
cd "$SELECTION"
while [ -z $CI ] && true; do
ORISELECTION=$SELECTION
# check empty ?
let i=0
items=()
gitems=()
VAR=$(ls -t -d ./*/ 2> /dev/null)
echo "$VAR" >/tmp/dirs
while read line; do
let i=$i+1
[[ "$VAR" != '' ]] && items+=( "$line" )
[[ "$VAR" != '' ]] && [[ "$(echo "$line" | grep -i "$SEARCH")" == *"$line"* ]] && gitems+=("$line" "$line")
done < /tmp/dirs
VAR=$(ls -t ./*.apk 2> /dev/null)
echo "$VAR" >/tmp/apks
while read line; do
let i=$i+1
[[ "$VAR" != '' ]] && items+=( "$line" )
[[ "$VAR" != '' ]] && gitems+=("$line" "$line")
done < /tmp/apks
#dialog --default-item "$OLDRES" --menu "Please choose a resolution:" 0 0 0 "1024" "1024" "1208" "1208" "1536" "1536" "2048" "2048" "2560" "2560" "3072" "3072"
#SELECTION=$(dialog --title "List file of directory" --fselect "$SELECTION/" 20 0 --output-fd 1)
SELECTION=$(dialog --extra-button --extra-label "search" --no-tags --default-item "$OLDRES" --title "Current dir: $PWD" --menu "Please select to an APK file to sideload:" 0 0 0 $([ "$MOUNTSUCCESS" == false ] && echo -e "$EXTRALINE") $([ "$MOUNTSUCCESS" == false ] && echo -e "$EXTRALINE") "../ (Directory up)" "../ (Directory up)" "${gitems[@]}" "../ (Directory up)" "../ (Directory up)" --output-fd 1)
[ $? -eq 3 ] && SEARCH=$(dialog --title "Search" --inputbox "Please enter a searchterm" 0 0 --output-fd 1) && continue
CLEANFOLDER=$(echo "$SELECTION" | sed -e 's/\\/\\\\/g' -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g')
#echo $SELECTION
[[ "$SELECTION" == *"trouble_mounting"* ]] && dialog --title "Where are the files?" --msgbox "Please contact me if you are experiencing issues mounting the drive.\n\nhttps://github.com/whitewhidow/quest-sideloader-linux/\nor\nhttps://t.me/whitewhidow" 0 0 && continue
[[ "$SELECTION" == "../"* ]] && cd ../ && continue
[[ -z $SELECTION ]] && exec /usr/local/bin/sideload-gui
[ $? -eq 0 ] && exec /usr/local/bin/sideload-gui
if [[ "$SELECTION" == *".apk" ]]; then
#zenity --question --width=800 --text="Select <b>$SELECTION</b> and start sideload? ?"
dialog --title "Continue?" --yesno "Select $SELECTION and start sideload? ?" 0 0
if [ $? = 0 ]; then
/usr/local/bin/sideload "$SELECTION" # | tee /tmp/sideload.log
#ISSUETEXT="If any error has occured, please provide me with a copy of the terminal window response at \n<a href=\"https://github.com/whitewhidow/quest-sideloader-linux/issues\">https://github.com/whitewhidow/quest-sideloader-linux/issues</a>\nor find me at t.me/whitewhidow_q2_working\n\nAnd i will gladly assist you!"
#zenity --info --width=800 --text="<b><u>The sideloading process has finished, please inspect the output in the terminal!</u></b>\n\n$ISSUETEXT"
#echo -e "\nThe sideloading process has finished, please inspect the output above for any errors."
#echo -e "\n$ISSUETEXT"
#echo -e ''
#read -p "Press enter to sideload another app. or CTRL+C to close the sideloader."
exec /usr/local/bin/sideload-gui
continue
else
echo -ne ''
fi
else
#cd "$SELECTION" 2>/dev/null && echo "cd to $SELECTION" || zenity --warning --width=800 --text="$SELECTION is not a valid APK or valid directory"
cd "$SELECTION" 2>/dev/null || dialog --title "Invalid" --msgbox "$SELECTION is not a valid APK or valid directory" 0 0
#SELECTION=$ORISELECTION
fi
done
exit 0