-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup
156 lines (152 loc) · 4.35 KB
/
setup
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#! /data/data/com.termux/files/usr/bin/bash
version=`getprop ro.build.version.release | sed -e 's/\.//g' | cut -c1`
version1=`getprop ro.build.version.release`
answer=$(mktemp)
HIDECURSOR(){ echo -en "\033[?25l";}
NORM(){ echo -en "\033[?12l\033[?25h";}
spin () {
local pid=$!
local delay=0.05
local spinstr='|/-\'
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
local temp=${spinstr#?}
HIDECURSOR
printf "\e[1;34m\r[*] \e[1;32mit will take time..Please wait... [\e[1;33m%c\e[1;32m]\e[0m " "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
printf " \b\b\b"
NORM
printf "\e[1;33m[Done]\e[0m"
echo ""
}
box()
{
local s=("$@") b w
for l in "${s[@]}"; do
((w<${#l})) && { b="$l"; w="${#l}"; }
done
tput setaf 3
echo " -${b//?/-}-
| ${b//?/ } |"
for l in "${s[@]}"; do
printf '| %s%*s%s |\n' "$(tput setaf 4)" "-$w" "$l" "$(tput setaf 3)"
done
echo "| ${b//?/ } |
-${b//?/-}-"
tput sgr 0
}
ask() {
local 'args' 'char' 'charcount' 'prompt' 'reply' 'silent'
# Basic arguments parsing
while [[ "${1++}" ]]; do
case "${1}" in
( '--silent' | '-s' )
silent='yes'
;;
( '--' )
args+=( "${@:2}" )
break
;;
( * )
args+=( "${1}" )
;;
esac
shift || break
done
if [[ "${silent}" == 'yes' ]]; then
for prompt in "${args[@]}"; do
charcount='0'
prompt="${prompt}: "
reply=''
while IFS='' read -n '1' -p "${prompt}" -r -s 'char'; do
case "${char}" in
# Handles NULL
( $'\000' )
break
;;
# Handles BACKSPACE and DELETE
( $'\010' | $'\177' )
if (( charcount > 0 )); then
prompt=$'\b \b'
reply="${reply%?}"
(( charcount-- ))
else
prompt=''
fi
;;
( * )
prompt='*'
reply+="${char}"
(( charcount++ ))
;;
esac
done
printf '\n' >&2
printf '%s\n' "${reply}" > ${answer}
done
else
for prompt in "${args[@]}"; do
IFS='' read -p "${prompt}: " -r 'reply'
printf '%s\n' "${reply}" > ${answer}
done
fi
}
PKG_INSTALL() {
echo -e "\e[35m[\e[33m*\e[35m] \e[32mInstalling packages and requirements..."
echo;
( apt update && apt upgrade -y;apt install figlet toilet ruby ncurses-utils wget exa termux-api termux-tools -y;gem install lolcat;wget -O $PREFIX/share/figlet/cricket.flf http://www.figlet.org/fonts/cricket.flf;wget -O $PREFIX/share/figlet/tinker-toy.flf http://www.figlet.org/fonts/tinker-toy.flf;) &> /dev/null & spin;
}
BANNER() {
clear;toilet -t -f tinker-toy " Tmux Banner." --gay -F border;tput cup 7 42;echo -e "\e[34mBoot Script \e[32m2.0\e[0m";tput cup 9 0;
}
COPY_FILES() {
rm -rf ~/.draw ~/.bashrc ~/.termux/*
cp .object/.draw .object/.bashrc ~/;
mkdir -p ~/.termux/;
if [ "$version" -le 7 ]; then
rm -rf $PREFIX/share/figlet/ASCII-Shadow.flf
cp .object/color*.* .object/font*.* ~/.termux/
cp .object/termux.properties2 ~/.termux/termux.properties
cp .object/ASCII-Shadow.flf $PREFIX/share/figlet/
else
rm -rf $PREFIX/share/figlet/ASCII-Shadow.flf
cp .object/color*.* .object/font*.* ~/.termux/;
cp .object/ASCII-Shadow.flf $PREFIX/share/figlet/
cp .object/termux.properties ~/.termux/
fi
if [ "$version1" -eq 10 ]; then
rm -rf $PREFIX/share/figlet/ASCII-Shadow.flf
cp .object/color*.* .object/font*.* ~/.termux/
cp .object/ASCII-Shadow.flf $PREFIX/share/figlet/
cp .object/termux.properties ~/.termux/
fi
}
clear
PKG_INSTALL
BANNER
echo
echo -e "$(tput setab 3)$(tput setab 1) Note : $(tput sgr 0)" "\e[0m\e[32m Type your username without using any blank space\e[0m";
echo
#(sleep 10) &> /dev/null & spin
echo -e "For Example : [Your_name] (Remo773 or remo773 or R3M0773)"
tput setaf 4
echo
ask "Enter Username "
usrn=`cat ${answer}`
if [ ${#usrn} -eq 0 ]; then
echo
echo -e "\e[35m[\e[33m*\e[35m] \e[32mYou have not type anything..\e[0m"
exit 0
else
echo "NAME=$(cat $answer)" > ~/.username
COPY_FILES
termux-reload-settings
source ~/.bashrc
termux-reload-settings
echo
echo -e "\e[35m[\e[33m*\e[35m] \e[32mSetup finished now, close your termux and reopen termux \e[0m"
termux-tts-speak -r 0.8 "Setup finished now, close your termux and reopen termux"
fi
#echo $BASHPID