Skip to content

Commit

Permalink
made changes
Browse files Browse the repository at this point in the history
in:
hippo fs manager:
added termux lock to run script only in termux(203)
VNCSERVER shrocuts are commented (tuned off)
some script enchangements
pulseeffetct/install.sh
added comments and attribution
version number change
  • Loading branch information
SaicharanKandukuri committed Jul 17, 2021
1 parent 7eeb8c1 commit 6fc365b
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 55 deletions.
126 changes: 72 additions & 54 deletions etc/scripts/hippo/hippo.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

version=1
version=2

if [ -n "$HIPPO_BRANCH" ]; then
BRANCH="$HIPPO_BRANCH"
Expand All @@ -20,11 +20,18 @@ SOCIAL_PLATFORM="\e[1;34mhttps://discord.gg/TAqaG5sEfW\e[0m"
# HIPPO_DIR = "${INSTALL_FOLDER}/${HIPPO_DEFAULT}"
# HIPPO_SCRIPT_FILE="${SCRIPT_DIR}/hippo.sh"

# * Usefull functions
# die() exit with code 1 with printing given string
# warn() like die() without exit status (used when exit is not necessary)
# shout() pring messege in a good way with some lines
# lshout() print messege in a standard way
# msg() print's normal echo

die () { echo -e "${RED}Error ${*}${RST}";exit 1 ;:;}
warn () { echo -e "${RED}Error ${*}${RST}";:;}
shout () { echo -e "${DS}////////";echo -e "${*}";echo -e "////////${RST}";:; }
lshout () { echo -e "${DC}";echo -e "${*}";echo -e "${RST}";:; }
msg () { echo -e "${@}" >&2 ;:; }


function __check_for_hippo() {
Expand Down Expand Up @@ -54,6 +61,18 @@ function __check_for_filesystem() {
fi
}

function __verify_bin_path()
{
BINPATH="${SHELL}"

if [ -z "$BINPATH" ]; then
if [ "$BINPATH" == "/data/data/com.termux/files/*" ]; then
msg "This has to be done inside termux environment"
die "\$SHELL != $BINPATH"
fi
fi
}

function __upgrade() {
# setup downloader
if ! command -v axel >> /dev/null; then
Expand All @@ -62,28 +81,28 @@ function __upgrade() {

mkdir -p "${CACHE_ROOT}"
axel -o "${CACHE_ROOT}"/version https://raw.githubusercontent.com/RandomCoderOrg/fs-manager-hippo/main/version >> /dev/null || {
echo "Error"; exit 1
die "error"
}

origin_version=$(cat "${CACHE_ROOT}"/version)

rm -rf "${CACHE_ROOT}"

if [ "$origin_version" -gt "$version" ]; then
echo -e "upgrdae avalibe to \e[1;32mV${origin_version}\e[0m"
lshout "upgrdae avalibe to \e[1;32mV${origin_version}\e[0m"
elif [ "$origin_version" -eq "$version" ]; then
echo -e "You are on latest version \e[1;32mV${origin_version}\e[0m"
lshout "You are on latest version \e[1;32mV${origin_version}\e[0m"
exit 0
else
echo "Upgrader hit unexpected condition..."
die "Upgrader hit unexpected condition..."
exit 1
fi

if start_upgrade; then
bash -x "${CACHE_ROOT}"/upgrade --summary
rm -rf "${CACHE_ROOT}"
else
echo "Error"
die "Error"
fi


Expand All @@ -92,7 +111,7 @@ function __upgrade() {
function start_upgrade() {
mkdir -p "${CACHE_ROOT}"
axel -o "${CACHE_ROOT}"/upgrade.sh https://raw.githubusercontent.com/RandomCoderOrg/fs-manager-hippo/main/etc/scripts/upgrade_patch/upgrade.sh >> /dev/null || {
echo "Error"; exit 1
die "Error"; exit 1
}
bash -x upgrade.sh || {
return 1
Expand Down Expand Up @@ -126,23 +145,22 @@ function __force_uprade_hippo()

function __help()
{
echo -e "hippo - termux Version ${version}"
echo -e "A bash script to make basic action(login, vncserver) easier for ubuntu-on-android project"
echo -e
echo -e "Usage ${0} [options]"
echo -e
echo -e "Options:"
echo -e "\e[1;34m"
echo -e "--install To try installing hippo"
echo -e "--help to display this message"
echo -e "--enable-dbus To start terminal session with dbus enabled"
echo -e "startvnc To start hippo vncserver"
echo -e "stopvnc To stop hippo vncserver"
echo -e "------------------"
# SOCIAL_MEDIA link goes here
echo -e "Join the community and leave at DISCORD -> $SOCIAL_PLATFORM"
echo -e "------------------"
echo -e "\e[0m"
msg "hippo - termux Version ${version}"
msg "A bash script to make basic action(login, vncserver) easier for ubuntu-on-android project"
msg
msg "Usage ${0} [options]"
msg
msg "Options:"
msg "\e[1;34m"
msg "--install To try installing hippo"
msg "--help to display this message"
msg "--enable-dbus To start terminal session with dbus enabled"
# msg "startvnc To start hippo vncserver"
# msg "stopvnc To stop hippo vncserver"
msg "------------------" #SOCIAL_MEDIA link goes here
msg "Join the community and leave at DISCORD -> $SOCIAL_PLATFORM"
msg "------------------"
msg "\e[0m"
}

function _lauch_or_install()
Expand All @@ -156,7 +174,7 @@ function _lauch_or_install()
if ! __check_for_filesystem; then
echo -e "Installing hippo..........."
if proot-distro install hippo; then
echo -e "Installation Done......\a\a"
echo -e "Installation Done......\a\a" # \a triggers vibration in termux
echo "Waiting..."
sleep 4
clear
Expand All @@ -169,20 +187,20 @@ function _lauch_or_install()


pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 >> /dev/null
if [[ -f "${CACHE_ROOT}"/fs-manager-hippo/etc/scripts/vncserver/startvnc.sh ]] && [[ ! -f ${HIPPO_DIR}/bin/startvnc ]]; then
DIR="${CACHE_ROOT}/fs-manager-hippo/etc/scripts/vncserver/startvnc.sh"
cp "${DIR}" ${HIPPO_DIR}/bin/startvnc
proot-distro login hippo -- chmod 775 /bin/startvnc
fi
if [ -f "${CACHE_ROOT}"/fs-manager-hippo/etc/scripts/vncserver/stopvnc.sh ] && [ ! -f ${HIPPO_DIR}/bin/stopvnc ]; then
DIR="${CACHE_ROOT}/fs-manager-hippo/etc/scripts/vncserver/stopvnc.sh"
cp "${DIR}" ${HIPPO_DIR}/bin/stopvnc
proot-distro login hippo -- chmod 775 /bin/stopvnc
fi
# if [[ -f "${CACHE_ROOT}"/fs-manager-hippo/etc/scripts/vncserver/startvnc.sh ]] && [[ ! -f ${HIPPO_DIR}/bin/startvnc ]]; then
# DIR="${CACHE_ROOT}/fs-manager-hippo/etc/scripts/vncserver/startvnc.sh"
# cp "${DIR}" ${HIPPO_DIR}/bin/startvnc
# proot-distro login hippo -- chmod 775 /bin/startvnc
# fi
# if [ -f "${CACHE_ROOT}"/fs-manager-hippo/etc/scripts/vncserver/stopvnc.sh ] && [ ! -f ${HIPPO_DIR}/bin/stopvnc ]; then
# DIR="${CACHE_ROOT}/fs-manager-hippo/etc/scripts/vncserver/stopvnc.sh"
# cp "${DIR}" ${HIPPO_DIR}/bin/stopvnc
# proot-distro login hippo -- chmod 775 /bin/stopvnc
# fi
proot-distro login hippo "$@" || warn "program exited unexpectedly..."
fi
}

__verify_bin_path
if [ $# -ge 1 ]; then
case "$1" in
upgrade) __upgrade;;
Expand All @@ -194,25 +212,25 @@ if [ $# -ge 1 ]; then
--install) _lauch_or_install;;
--help) __help;;

startvnc)
if __check_for_hippo; then
proot-distro login hippo -- startvnc
else
echo -e "This command is supposed to run after installing hippo"
# echo -e "Use \e[1;32mhippo --install\e[0m install"
echo -e "\e[32mError:\e[0m Hippo not found"
fi
;;
# startvnc)
# if __check_for_hippo; then
# proot-distro login hippo -- startvnc
# else
# echo -e "This command is supposed to run after installing hippo"
# # echo -e "Use \e[1;32mhippo --install\e[0m install"
# echo -e "\e[32mError:\e[0m Hippo not found"
# fi
# ;;

stoptvnc)
if __check_for_hippo; then
proot-distro login hippo -- stoptvnc
else
echo -e "This command is supposed to run after installing hippo"
# echo -e "Use \e[1;32mhippo --install\e[0m install"
echo -e "\e[32mError:\e[0m Hippo not found"
fi
;;
# stoptvnc)
# if __check_for_hippo; then
# proot-distro login hippo -- stoptvnc
# else
# echo -e "This command is supposed to run after installing hippo"
# # echo -e "Use \e[1;32mhippo --install\e[0m install"
# echo -e "\e[32mError:\e[0m Hippo not found"
# fi
# ;;
*) _lauch_or_install "$@";;
esac
else
Expand Down
13 changes: 13 additions & 0 deletions etc/scripts/pulseeffects/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/usr/bin/env bash

################################################################
# A script to install pulse effects in Debian/ubuntu systems
# Copyright (c) 2021 1x1-RC Org
# Copyright (c) zman-1x1
# package installer used:
# * "apt" at lines (25,32)
#

# * Usefull functions
# die() exit with code 1 with printing given string
# warn() like die() without exit status (used when exit is not necessary)
Expand All @@ -11,6 +19,11 @@ warn () { echo -e "${RED}Error ${*}${RST}";:;}
shout () { echo -e "${DC}-----";echo -e "${*}";echo -e "-----${RST}";:; }
lshout () { echo -e "${DC}";echo -e "${*}";echo -e "${RST}";:; }

###################################################################
# 1. Update apt indexs
# 2. install pulseeffcts
# 3. startpulsle effetcs with a 9 seconds wait time
# -> it any condition returns non zero or command internal error script fails
shout "trying to update indexes........."
apt update; apt upgrade -y || {
warn "failed to update indexes..."
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0
2

0 comments on commit 6fc365b

Please sign in to comment.