mirror of https://github.com/coddrago/Heroku
commit
a7c57e288d
36
install.sh
36
install.sh
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
if [ ! -n "$BASH" ]; then
|
if [ ! -n "$BASH" ]; then
|
||||||
echo "Non-bash shell detected, fixing..."
|
echo "Non-bash shell detected, fixing..."
|
||||||
bash -c '. <('"$(command -v curl >/dev/null && echo 'curl -Ls' || echo 'wget -qO-')"' https://github.com/GeekTG/Friendly-Telegram/raw/master/install.sh) '"$*"
|
bash -c '. <('"$(command -v curl >/dev/null && echo 'curl -Ls' || echo 'wget -qO-')"' https://github.com/hikariatama/Hikka/master/install.sh) '"$*"
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ endspin() {
|
||||||
|
|
||||||
runin() {
|
runin() {
|
||||||
# Runs the arguments and spins once per line of stdout (tee'd to logfile), also piping stderr to logfile
|
# Runs the arguments and spins once per line of stdout (tee'd to logfile), also piping stderr to logfile
|
||||||
{ "$@" 2>>../ftg-install.log || return $?; } | while read -r line; do
|
{ "$@" 2>>../hikka-install.log || return $?; } | while read -r line; do
|
||||||
spin
|
spin
|
||||||
printf "%s\n" "$line" >>../ftg-install.log
|
printf "%s\n" "$line" >>../ftg-install.log
|
||||||
done
|
done
|
||||||
|
@ -26,19 +26,19 @@ runin() {
|
||||||
|
|
||||||
runout() {
|
runout() {
|
||||||
# Runs the arguments and spins once per line of stdout (tee'd to logfile), also piping stderr to logfile
|
# Runs the arguments and spins once per line of stdout (tee'd to logfile), also piping stderr to logfile
|
||||||
{ "$@" 2>>ftg-install.log || return $?; } | while read -r line; do
|
{ "$@" 2>>hikka-install.log || return $?; } | while read -r line; do
|
||||||
spin
|
spin
|
||||||
printf "%s\n" "$line" >>ftg-install.log
|
printf "%s\n" "$line" >>hikka-install.log
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
errorin() {
|
errorin() {
|
||||||
endspin "$@"
|
endspin "$@"
|
||||||
cat ../ftg-install.log
|
cat ../hikka-install.log
|
||||||
}
|
}
|
||||||
errorout() {
|
errorout() {
|
||||||
endspin "$@"
|
endspin "$@"
|
||||||
cat ftg-install.log
|
cat hikka-install.log
|
||||||
}
|
}
|
||||||
|
|
||||||
# Banner generated with following command:
|
# Banner generated with following command:
|
||||||
|
@ -69,9 +69,9 @@ printf '%s' "Installing now... "
|
||||||
|
|
||||||
spin
|
spin
|
||||||
|
|
||||||
touch ftg-install.log
|
touch hikka-install.log
|
||||||
if [ ! x"$SUDO_USER" = x"" ]; then
|
if [ ! x"$SUDO_USER" = x"" ]; then
|
||||||
chown "$SUDO_USER:" ftg-install.log
|
chown "$SUDO_USER:" hikka-install.log
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! x"" = x"$DYNO" ] && ! command -v python >/dev/null; then
|
if [ ! x"" = x"$DYNO" ] && ! command -v python >/dev/null; then
|
||||||
|
@ -93,14 +93,14 @@ if [ ! x"" = x"$DYNO" ] && ! command -v python >/dev/null; then
|
||||||
export PATH="/app/.heroku/python/bin:$PATH" # Prefer the bootstrapped python, incl. pip, over the system one.
|
export PATH="/app/.heroku/python/bin:$PATH" # Prefer the bootstrapped python, incl. pip, over the system one.
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "Friendly-Telegram/friendly-telegram" ]; then
|
if [ -d "Hikka/hikka" ]; then
|
||||||
cd Friendly-Telegram || {
|
cd Hikka || {
|
||||||
endspin "Error: Install git package and re-run installer"
|
endspin "Error: Install git package and re-run installer"
|
||||||
exit 6
|
exit 6
|
||||||
}
|
}
|
||||||
DIR_CHANGED="yes"
|
DIR_CHANGED="yes"
|
||||||
fi
|
fi
|
||||||
if [ -f ".setup_complete" ] || [ -d "friendly-telegram" -a ! x"" = x"$DYNO" ]; then
|
if [ -f ".setup_complete" ] || [ -d "hikka" -a ! x"" = x"$DYNO" ]; then
|
||||||
# If ftg is already installed by this script, or its in Heroku and installed
|
# If ftg is already installed by this script, or its in Heroku and installed
|
||||||
PYVER=""
|
PYVER=""
|
||||||
if echo "$OSTYPE" | grep -qE '^linux-gnu.*'; then
|
if echo "$OSTYPE" | grep -qE '^linux-gnu.*'; then
|
||||||
|
@ -109,7 +109,7 @@ if [ -f ".setup_complete" ] || [ -d "friendly-telegram" -a ! x"" = x"$DYNO" ]; t
|
||||||
endspin "Existing installation detected"
|
endspin "Existing installation detected"
|
||||||
clear
|
clear
|
||||||
banner
|
banner
|
||||||
"python$PYVER" -m friendly-telegram "$@"
|
"python$PYVER" -m hikka "$@"
|
||||||
exit $?
|
exit $?
|
||||||
elif [ "$DIR_CHANGED" = "yes" ]; then
|
elif [ "$DIR_CHANGED" = "yes" ]; then
|
||||||
cd ..
|
cd ..
|
||||||
|
@ -117,7 +117,7 @@ fi
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
echo "Installing..." >ftg-install.log
|
echo "Installing..." >hikka-install.log
|
||||||
|
|
||||||
if echo "$OSTYPE" | grep -qE '^linux-gnu.*' && [ -f '/etc/debian_version' ]; then
|
if echo "$OSTYPE" | grep -qE '^linux-gnu.*' && [ -f '/etc/debian_version' ]; then
|
||||||
PKGMGR="apt install -y"
|
PKGMGR="apt install -y"
|
||||||
|
@ -126,7 +126,7 @@ if echo "$OSTYPE" | grep -qE '^linux-gnu.*' && [ -f '/etc/debian_version' ]; the
|
||||||
if command -v sudo >/dev/null; then
|
if command -v sudo >/dev/null; then
|
||||||
endspin "Restarting as root..."
|
endspin "Restarting as root..."
|
||||||
echo "Relaunching" >>ftg-install.log
|
echo "Relaunching" >>ftg-install.log
|
||||||
sudo "$BASH" -c '. <('"$(command -v curl >/dev/null && echo 'curl -Ls' || echo 'wget -qO-')"' https://github.com/GeekTG/Friendly-Telegram/raw/master/install.sh) '"$*"
|
sudo "$BASH" -c '. <('"$(command -v curl >/dev/null && echo 'curl -Ls' || echo 'wget -qO-')"' https://github.com/hikariatama/Hikka/master/install.sh) '"$*"
|
||||||
exit $?
|
exit $?
|
||||||
else
|
else
|
||||||
PKGMGR="true"
|
PKGMGR="true"
|
||||||
|
@ -143,7 +143,7 @@ elif echo "$OSTYPE" | grep -qE '^linux-gnu.*' && [ -f '/etc/arch-release' ]; the
|
||||||
if command -v sudo >/dev/null; then
|
if command -v sudo >/dev/null; then
|
||||||
endspin "Restarting as root..."
|
endspin "Restarting as root..."
|
||||||
echo "Relaunching" >>ftg-install.log
|
echo "Relaunching" >>ftg-install.log
|
||||||
sudo "$BASH" -c '. <('"$(command -v curl >/dev/null && echo 'curl -Ls' || echo 'wget -qO-')"' https://github.com/GeekTG/Friendly-Telegram/raw/master/install.sh) '"$*"
|
sudo "$BASH" -c '. <('"$(command -v curl >/dev/null && echo 'curl -Ls' || echo 'wget -qO-')"' https://github.com/hikariatama/Hikka/master/install.sh) '"$*"
|
||||||
exit $?
|
exit $?
|
||||||
else
|
else
|
||||||
PKGMGR="true"
|
PKGMGR="true"
|
||||||
|
@ -161,7 +161,7 @@ elif echo "$OSTYPE" | grep -qE '^darwin.*'; then
|
||||||
PKGMGR="brew install"
|
PKGMGR="brew install"
|
||||||
PYVER="3"
|
PYVER="3"
|
||||||
else
|
else
|
||||||
endspin "Unrecognised OS. Please follow https://ftg.geektg.ml/#installation"
|
endspin "Unrecognised OS. Please follow https://t.me/hikka_talks"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ fi
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
${SUDO_CMD}rm -rf Friendly-Telegram
|
${SUDO_CMD}rm -rf Friendly-Telegram
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
runout ${SUDO_CMD}git clone https://github.com/GeekTG/Friendly-Telegram || {
|
runout ${SUDO_CMD}git clone https://github.com/hikariatama/Hikka/ || {
|
||||||
errorout "Clone failed."
|
errorout "Clone failed."
|
||||||
exit 3
|
exit 3
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ endspin "Installation successful. Launching setup interface..."
|
||||||
rm -f ../ftg-install.log
|
rm -f ../ftg-install.log
|
||||||
touch .setup_complete
|
touch .setup_complete
|
||||||
# shellcheck disable=SC2086,SC2015
|
# shellcheck disable=SC2086,SC2015
|
||||||
${SUDO_CMD}"python$PYVER" -m friendly-telegram "$@" || {
|
${SUDO_CMD}"python$PYVER" -m hikka "$@" || {
|
||||||
echo "Python scripts failed"
|
echo "Python scripts failed"
|
||||||
exit 5
|
exit 5
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue