diff --git a/.github/workflows/gitflow.yml b/.github/workflows/gitflow.yml index 75a28b0..4d664a7 100644 --- a/.github/workflows/gitflow.yml +++ b/.github/workflows/gitflow.yml @@ -26,8 +26,14 @@ jobs: - uses: actions/checkout@v2 # Runs a single command using the runners shell + - name: Wait + run: sleep 10 - name: Run install - run: $GITHUB_WORKSPACE/install.sh + run: $GITHUB_WORKSPACE/install.sh local + - name: Run sideload-gui + run: sideload-gui + - name: Run ww-mount + run: whitewhidow-mount /mnt/tmp - name: Run sideload run: cd extras && sideload # Runs a set of commands using the runners shell diff --git a/README.md b/README.md index c7a2b8c..ab0b537 100644 --- a/README.md +++ b/README.md @@ -3,33 +3,57 @@ Quest Sideloader for Linux and Mac with integrated drive access to app library. # Install (and/or) Update: +Latest Stable: ``` -sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/whitewhidow/quest-sideloader-linux/main/install.sh)" +curl -fsSL https://raw.githubusercontent.com/whitewhidow/quest-sideloader-linux/development/install.sh | /bin/bash -s -- main +``` +Latest Dev: +``` +curl -fsSL https://raw.githubusercontent.com/whitewhidow/quest-sideloader-linux/development/install.sh | /bin/bash -s -- development ```
Example output: ``` -OS: Linux DETECTED +==================================================================== += Quest(1/2) sideloader for Linux & Mac(OSX) ======================= +==================================================================== +========================================= by Whitewhidow/BranchBit = +===================================== support:contact@branchbit.be = +============================== https://t.me/whitewhidow_q2_working = +================ www.github.com/whitewhidow/quest-sideloader-linux = +==================================================================== + CHECKING AND INSTALLING DEPENDENCIES: -Downloading and unzipping newest version. +Checking git installation. +Git installed +Checking unzip installation. +Unzip installed Checking adb. -Attempting to install missing 'adb' package. (requires sudo) -Adb copied from linux_adb_lib/adb to /usr/local/bin. Adb installed Checking aapt. -Attempting to install missing 'aapt' package. (requires sudo) -Aapt copied from linux_aapt_lib/aapt to /usr/local/bin. Aapt installed Checking zenity. Zenity installed Checking rclone. Rclone installed +Fetching newest version (main). +Cloning into 'quest-sideloader-linux'... +remote: Enumerating objects: 273, done. +remote: Counting objects: 100% (273/273), done. +remote: Compressing objects: 100% (185/185), done. +remote: Total 1210 (delta 164), reused 160 (delta 73), pack-reused 937 +Receiving objects: 100% (1210/1210), 8.84 MiB | 10.12 MiB/s, done. +Resolving deltas: 100% (713/713), done. +Already on 'main' +Your branch is up to date with 'origin/main'. Copying executables to PATH (requires sudo) -Removing downloaded files - -> Install seems to have been successfull, you can now run 'sideload-gui' + -> Install seems to have been successfull, you can now run 'sideload-gui' to open the sideloader. + + -> To self-update this package run 'sideload-update'. + ```
diff --git a/extras/web.jpg b/extras/web.jpg new file mode 100644 index 0000000..5aef28b Binary files /dev/null and b/extras/web.jpg differ diff --git a/install.sh b/install.sh index de8b220..0e65082 100755 --- a/install.sh +++ b/install.sh @@ -12,14 +12,22 @@ echo -e "============================== https://t.me/whitewhidow_q2_working =" echo -e "================ www.github.com/whitewhidow/quest-sideloader-linux =" echo -e "====================================================================" printf "\n" +case "$OSTYPE" in + linux*) OSTYPE="linux" ;; + darwin*) OSTYPE="mac" ;; + *) echo "unknown OS: $OSTYPE DETECTED" && echo "please submit a ticket om github?" && sleep 30 && exit ;; +esac -case "$OSTYPE" in - linux*) echo "OS: Linux DETECTED" && OSTYPE="linux" ;; - darwin*) echo "Mac OS DETECTED" && OSTYPE="mac" ;; - *) echo "unknown OS: $OSTYPE DETECTED" && echo "please submit a ticket om github?" && exit ;; -esac + +function failed(){ + LINE="\n\nInstall seems to have failed with the following reason:\n\n$1.\n\nPlease paste the terminal output to github,\nI will gladly assist! \n" + [ -z $CI ] && zenity --warning --text="$LINE" --width="600" + echo -e "$LINE" + read -p "Press [ENTER] to continue." < "$(tty 0>&2)" + exit 1 +} @@ -29,93 +37,159 @@ echo "CHECKING AND INSTALLING DEPENDENCIES:" if [ $OSTYPE == "mac" ]; then echo "Checking brew for mac." if [[ $(which brew) != *"brew"* ]]; then - echo "Attempting to install missing 'brew' package. (requires sudo)" + echo "-> Please wait while we attempt to install missing 'brew' package. (requires sudo)" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" && echo "Brew installed." fi fi -#echo "Checking unzip installation." -if [[ $(which unzip) != *"unzip"* ]]; then - echo "Attempting to install missing 'unzip' pakckage. (requires sudo)" - (sudo apt install unzip > /dev/null 2> /dev/null || brew install unzip > /dev/null 2> /dev/null) && echo "Unzip installed." -fi +echo "Checking git installation." +if ! command -v git &> /dev/null; then + echo "-> Please wait while we attempt to install missing 'git' package. (requires sudo)" + (sudo apt install git > /dev/null 2> /dev/null || brew git unzip > /dev/null 2> /dev/null) && echo "Unzip installed." +fi +if ! command -v git &> /dev/null; then + failed "Git could not be installed ?" +else + echo "Git installed" + GITINSTALLED=true +fi -OLDPATH="$PWD" -rm -rf /tmp/sideload-install -mkdir /tmp/sideload-install -cd /tmp/sideload-install -BRANCH="main" -if [ ! -z $CI ]; then - #BRANCH=$(echo "$GITHUB_REF" | awk -F'/' '{print $3}') - BRANCH="development" -fi -echo "Downloading and unzipping newest ($BRANCH) version." -rm -f ./quest-sideloader-linux-$BRANCH.zip 2> /dev/null -curl --silent https://codeload.github.com/whitewhidow/quest-sideloader-linux/zip/$BRANCH -o quest-sideloader-linux-$BRANCH.zip > /dev/null -unzip -oq quest-sideloader-linux-$BRANCH.zip && cd quest-sideloader-linux-$BRANCH > /dev/null +echo "Checking unzip installation." +if ! command -v unzip &> /dev/null; then + echo "-> Please wait while we attempt to install missing 'unzip' pakckage. (requires sudo)" + (sudo apt install unzip > /dev/null || brew install unzip > /dev/null ) && echo "Unzip installed." +fi +if ! command -v unzip &> /dev/null; then + failed "Unzip could not be installed ?" +else + echo "Unzip installed" + UNZIPINSTALLED=true +fi +echo "Checking adb." +if ! command -v adb &> /dev/null; then + if [ $OSTYPE == "mac" ]; then + echo "-> Please wait while we attempt to install missing 'adb' package. (requires sudo)" + mkdir -p ${OSTYPE}_adb_lib + curl --silent https://raw.githubusercontent.com/whitewhidow/quest-sideloader-linux/$BRANCH/${OSTYPE}_adb_lib/adb -o ${OSTYPE}_adb_lib/adb > /dev/null + chmod +x ${OSTYPE}_adb_lib/adb + sudo rm -f /usr/local/bin/adb 2> /dev/null + sudo cp ${OSTYPE}_adb_lib/adb /usr/local/bin && echo "Adb copied from ${OSTYPE}_adb_lib/adb to /usr/local/bin." + rm -rf ${OSTYPE}_adb_lib/ + fi + + if [ $OSTYPE == "linux" ]; then + echo "-> Please wait while we attempt to install missing 'adb' package. (requires sudo)" + sudo apt install android-tools-adb > /dev/null + fi +fi +if ! command -v adb &> /dev/null; then + failed "Adb could not be installed ?" +else + echo "Adb installed" + ADBINSTALLED=true +fi -echo "Checking adb." -if [[ $(which adb) != *"adb"* ]]; then - echo "Attempting to install missing 'adb' package. (requires sudo)" - mkdir -p ${OSTYPE}_adb_lib - curl --silent https://raw.githubusercontent.com/whitewhidow/quest-sideloader-linux/$BRANCH/${OSTYPE}_adb_lib/adb -o ${OSTYPE}_adb_lib/adb > /dev/null - chmod +x ${OSTYPE}_adb_lib/adb - sudo rm -f /usr/local/bin/adb 2> /dev/null - sudo cp ${OSTYPE}_adb_lib/adb /usr/local/bin && echo "Adb copied from ${OSTYPE}_adb_lib/adb to /usr/local/bin." - rm -rf ${OSTYPE}_adb_lib/ -fi -echo "Adb installed" echo "Checking aapt." -if [[ $(which aapt) != *"aapt"* ]]; then - echo "Attempting to install missing 'aapt' package. (requires sudo)" - mkdir -p ${OSTYPE}_aapt_lib - curl --silent https://raw.githubusercontent.com/whitewhidow/quest-sideloader-linux/$BRANCH/${OSTYPE}_aapt_lib/aapt -o ${OSTYPE}_aapt_lib/aapt > /dev/null - chmod +x ${OSTYPE}_aapt_lib/aapt - - sudo rm -f /usr/local/bin/aapt 2> /dev/null - sudo rm -f /usr/bin/aapt 2> /dev/null - - sudo cp ${OSTYPE}_aapt_lib/aapt /usr/bin - sudo cp ${OSTYPE}_aapt_lib/aapt /usr/local/bin - - echo "Aapt copied from ${OSTYPE}_aapt_lib/aapt to /usr/local/bin." - rm -rf ${OSTYPE}_aapt_lib/ +if ! command -v aapt &> /dev/null; then + if [ $OSTYPE == "linux" ]; then + echo "-> Please wait while we attempt to install missing 'aapt' package. (requires sudo)" + sudo apt install android-sdk-build-tools > /dev/null + fi + if [ $OSTYPE == "mac" ]; then + echo "PLEASE INSTALL aapt from androidaapt.com, WE WILL JUST DOWNLOAD LOCALLY FOR NOW, NO WORRIES !" + info "DOWNLOADING https://raw.githubusercontent.com/whitewhidow/quest-sideloader-linux/main/mac_aapt_lib/aapt" + curl -s https://raw.githubusercontent.com/whitewhidow/quest-sideloader-linux/main/mac_aapt_lib/aapt -o aapt + chmod +x ./aapt + AAPT="./aapt" + echo "PLEASE INSTALL aapt from androidaapt.com to avoid this download in the future !!" + fi +fi + +if ! command -v aapt &> /dev/null; then + failed "Aapt could not be installed ?" +else + echo "Aapt installed" + AAPTINSTALLED=true fi -echo "Aapt installed" + + + + + + + echo "Checking zenity." -if [[ $(which zenity) != *"zenity"* ]]; then - echo "Attempting to install missing 'zenity' package. (requires sudo)" - (sudo apt install zenity > /dev/null 2> /dev/null || brew install zenity > /dev/null 2> /dev/null) && echo "Zenity installed." +if ! command -v zenity &> /dev/null; then + echo "-> Please wait while we attempt to install missing 'zenity' package. (requires sudo)" + (sudo apt install zenity > /dev/null 2> /dev/null || brew install zenity > /dev/null 2> /dev/null) fi -echo "Zenity installed" +if ! command -v zenity &> /dev/null; then + failed "Zenity could not be installed ?" +else + echo "Zenity installed" + ZENITYINSTALLED=true +fi + + echo "Checking rclone." -if [[ $(which rclone) != *"rclone"* ]]; then - echo "Attempting to install missing 'rclone' paackage. (requires sudo)" - curl --silent https://rclone.org/install.sh | sudo bash +if ! command -v rclone &> /dev/null; then + echo "-> Please wait while we attempt to install missing 'rclone' paackage. (requires sudo)" + curl --silent https://rclone.org/install.sh | sudo bash > /dev/null +fi +if ! command -v rclone &> /dev/null; then + failed "Rclone could not be installed ?" +else + echo "Rclone installed" + RCLONEINSTALLED=true +fi + + + +BRANCH="main" +if [ ! -z "$1" ]; then + BRANCH="$1" +fi +if [[ "$BRANCH" == "local" ]]; then + echo -ne "" +fi + + +echo "Fetching newest version ($BRANCH)." + + +OLDPATH="$PWD" + +if [[ "$BRANCH" == "local" ]]; then + cd $OLDPATH +else + cd /tmp + rm -rf ./quest-sideloader-linux + git clone https://github.com/whitewhidow/quest-sideloader-linux.git + cd quest-sideloader-linux + git checkout $BRANCH fi -echo "Rclone installed" @@ -127,31 +201,22 @@ sudo cp ./whitewhidow-mount.sh /usr/local/bin/whitewhidow-mount sudo cp ./install.sh /usr/local/bin/sideload-update -echo "Removing downloaded files" cd $OLDPATH -rm -rf /tmp/sideload-install - - - - - -if [[ $(which adb) == *"adb"* ]] && [[ $(which aapt) == *"aapt"* ]] && [[ $(which rclone) == *"rclone"* ]] && [[ $(which zenity) == *"zenity"* ]] && [[ $(which unzip) == *"unzip"* ]] && [[ $(which sideload) == *"sideload"* ]] && [[ $(which sideload-gui) == *"sideload-gui"* ]] && [[ $(which sideload-update) == *"sideload-update"* ]]; then - echo -e "\n\n -> Install seems to have been successfull, you can now run 'sideload-gui'\n" +if [[ "$ADBINSTALLED" ]] && [[ "$AAPTINSTALLED" ]] && [[ "$RCLONEINSTALLED" ]] && [[ "$ZENITYINSTALLED" ]] && [[ "$UNZIPINSTALLED" ]] && [[ $(which sideload) == *"sideload"* ]] && [[ $(which sideload-gui) == *"sideload-gui"* ]] && [[ $(which sideload-update) == *"sideload-update"* ]]; then + echo -e "\n\n -> Install seems to have been successfull, you can now run 'sideload-gui' to open the sideloader.\n\n -> To self-update this package run 'sideload-update'.\n\n" [ -z $CI ] && zenity --question --text="whitewhidow/quest-sideloader-linux for Linux and Mac seems to have been successful,\nwould you like to open the sideload-gui now?" --width="600" if [ $? = 0 ]; then exec sideload-gui exit 0 fi else - [ -z $CI ] && zenity --warning --text="Install seems to have failed, please post the terminal output to\nhttp://www.github.com/whitewhidow/quest-sideloader-linux,\nand i will gladly assist!" --width="600" - echo -e "\n\n -> Install seems to have failed, please post the terminal output to www.github.com/whitewhidow/quest-sideloader-linux,\ni will gladly assist! \n" - read -p "Press [ENTER] to continue." < "$(tty 0>&2)" - exit 1 + failed '' fi + diff --git a/sideload-gui.sh b/sideload-gui.sh index 3414d4f..eeecf13 100755 --- a/sideload-gui.sh +++ b/sideload-gui.sh @@ -19,7 +19,7 @@ fi #fi echo "Checking zenity installation." -if [[ $(which zenity) != *"zenity"* ]]; then +if [ -z $CI ] && [[ $(which zenity 2> /dev/null) != *"zenity"* ]]; then echo "Installing zenity." (sudo apt install zenity > /dev/null 2> /dev/null || brew install zenity > /dev/null 2> /dev/null) && echo "zenity installed." else @@ -29,21 +29,27 @@ fi FOLDER=$HOME -zenity --question --width=800 --text="Would you like to browse the drive directly? [!BETA!]" +[ -z $CI ] && zenity --question --width=800 --text="Would you like to browse the drive directly? [!BETA!]" if [ $? = 0 ]; then echo "Attempting to serve the mount, Please wait." - nohup whitewhidow-mount "/tmp/mnt" /dev/null 2>&1 & + nohup whitewhidow-mount "/tmp/mnt" fromgui /dev/null 2>&1 & + ##MOUNTCHECK sleep 1 echo "just 2 more seconds, to make sure rclone had time to mount.." sleep 2 FOLDER="/tmp/mnt/" if [ ! "$(ls -A $FOLDER)" ]; then + echo "Still no mount, lets wait another 5.." + if [ ! "$(ls -A $FOLDER)" ]; then - zenity --warning --text="\nERROR\n\nSomething is wrong, the folder seems to return as empty.\nif you report this at www.github.com/whitewhidow/quest-sideloader-linux, I will be happy to help" --width="600" - echo "\nERROR\n\nSomething is wrong, the folder seems to return as empty.\nif you report this at www.github.com/whitewhidow/quest-sideloader-linux, I will be happy to help" + zenity --warning --text="\nERROR\n\nSomething is wrong, the folder seems to return as empty.\nif you report this at www.github.com/whitewhidow/quest-sideloader-linux, I will be happy to help" --width="600" + echo "\nERROR\n\nSomething is wrong, the folder seems to return as empty.\nif you report this at www.github.com/whitewhidow/quest-sideloader-linux, I will be happy to help" + + fi fi - echo "Drive successfully mounted." + zenity --info --text="\n\n Drive now mounted at: $FOLDER ($(ls -A $FOLDER | wc -l) folders available)\n\n" --width="600" + ##MOUNTCHECK else echo -ne fi @@ -54,7 +60,7 @@ fi cd "$FOLDER" -while true; do +while [ -z $CI ] && true; do #FOLDER=$PWD FOLDER=$(zenity --file-selection --title="Please navigate to an (single) app location and click [OK]" --directory --filename="$FOLDER" ) #FOLDER=$(ls -t |sed '1s/^/Need all apps ? -> https\:\/\/t.me\/whitewhidow_q2_working \n/'|sed '$ a ../' | zenity --list --title="Browser for whitewhidow/quest-sideloader-linux" --text="Please browse to an (single) app location" \ @@ -65,10 +71,10 @@ while true; do #[[ "$FOLDER" == *".." ]] && cd .. && continue; [ $? -eq 0 ] && break; - + cd "$FOLDER" APKCOUNT=$(ls -t | grep .apk | wc -l) APKCOUNT=$(echo "$APKCOUNT" | sed 's/^[[:space:]]*//') - #echo "APKcount in folder: $APKCOUNT" + echo "APKcount in $FOLDER: $APKCOUNT" if [[ $APKCOUNT == 1 ]]; then zenity --question --width=800 --text="Do you want to install the apk found in \"$FOLDER\" ?" @@ -82,7 +88,7 @@ while true; do cd .. fi elif [[ $APKCOUNT == 0 ]]; then - zenity --info --width=800 --text="No PKA found in \"$FOLDER\"\nPlease select a single app directory." + zenity --info --width=800 --text="No APK found in \"$FOLDER\"\nPlease select a single app directory." elif [[ $APKCOUNT > 1 ]]; then zenity --info --width=800 --text="Too many PKA's found in \"$FOLDER/*\"\nPlease select a single app directory." fi diff --git a/sideload.sh b/sideload.sh index 9bbd4a2..dcbfa09 100755 --- a/sideload.sh +++ b/sideload.sh @@ -1,4 +1,5 @@ #!/bin/bash + printf "\n" printf "\n" printf "\n" @@ -11,6 +12,12 @@ echo -e "============================== https://t.me/whitewhidow_q2_working =" echo -e "================ www.github.com/whitewhidow/quest-sideloader-linux =" echo -e "====================================================================" printf "\n" +case "$OSTYPE" in + linux*) OSTYPE="linux" ;; + darwin*) OSTYPE="mac" ;; + *) echo "unknown OS: $OSTYPE DETECTED" && echo "please submit a ticket om github?" && sleep 30 && exit ;; +esac + #some settings @@ -53,145 +60,66 @@ function verify(){ + + + + #start -##OS DETECT -WSL=$(uname -r | grep Microsoft > /dev/null && echo "WSL") -if [ "$WSL" == "WSL" ] -then - if [ "$WSL_INTEROP" ] - then - WSL="WSL2" - OSTYPE="WSL2" - else - WSL="WSL1" - OSTYPE="WSL1" - fi -fi -#OSTYPE="WSL1" -info "OS Detection" -case "$OSTYPE" in - linux*) ok "Linux DETECTED" && OSTYPE="Linux" ;; - WSL1*) ok "WINDOWS SUBSYSTEM FOR LINUX DETECTED" && OSTYPE="WSL1" ;; - WSL2*) ok "WSL2 DETECTED" && OSTYPE="WSL2" ;; - darwin*) ok "Mac OS DETECTED" && OSTYPE="Mac" ;; - win*) ok "Windows DETECTED" && OSTYPE="Windows" ;; - cygwin*) ok "Cygwin DETECTED" && OSTYPE="Cygwin" ;; - bsd*) ok "BSD DETECTED" && OSTYPE="BSD" ;; - solaris*) ok "Solaris DETECTED" && OSTYPE="Solaris" ;; - *) error "unknown OS: $OSTYPE DETECTED" && echo "please submit a ticket ?" && exit 0 ;; -esac -#END OS DETECT -if [ $OSTYPE == "WSL1" ]; then - error "WINDOWS HOST ADB CAN NOT BE AUTOMATICALLY COMPLETED" - warning "" - warning "YOU ARE USING WSL1, THIS SCRIPT DOES NOT KNOW IF YOU HAVE ADB INSTALLED IN WINDOWS OR NOT" - warning "PLEASE MAKE SURE YOUR HOST(WINDOWS) HAS THE FOLLOWING ADB VERSION(30.0.4) INSTALLED AND DETECTS YOUR DEVICE: " - warning "https://dl.google.com/android/repository/platform-tools_r30.0.4-windows.zip" - warning "AS YOUR WSL's ADB WILL CONNECT TO THE ADB ON YOU WINDOWS HOST" - warning "" - echo -e "${BLUE}" - read -p "VERIFY THE ABOVE INFO, AND CLICK ANY KEY TO CONINUE" - #$ADB kill-server 2> /dev/null -fi -## ADB INSTALL -info "LOCAL ADB Detection" -if [[ $(which $ADB) == *"$ADB"* ]] -then - ADBGLOBALINSTALLED=true -else - ADBGLOBALINSTALLED=false -fi +command -v adb &> /dev/null && ADBINSTALLED=true +command -v aapt &> /dev/null && AAPTINSTALLED=true +command -v rclone &> /dev/null && RCLONEINSTALLED=true +command -v zenity &> /dev/null && ZENITYINSTALLED=true +command -v unzip &> /dev/null && UNZIPINSTALLED=true -if [ "$ADBGLOBALINSTALLED" == false ]; then - if [ $OSTYPE == "Linux" ]; then - warning "PLEASE INSTALL adb from android-platform-tools, WE WILL JUST DOWNLOAD LOCALLY FOR NOW, NO WORRIES !" - info "DOWNLOADING https://dl.google.com/android/repository/platform-tools_r30.0.4-linux.zip" - curl -s -f https://dl.google.com/android/repository/platform-tools_r30.0.4-linux.zip -o platform-tools-linux.zip - unzip -oq platform-tools-linux.zip - ln -sf ./platform-tools/adb ./adb - chmod +x ./adb - ADB="./adb" - warning "PLEASE INSTALL adb from android-platform-tools to avoid this download in the future !" - fi - if [ $OSTYPE == "Mac" ]; then - warning "PLEASE INSTALL adb from android-platform-tools, WE WILL JUST DOWNLOAD LOCALLY FOR NOW, NO WORRIES !" - info "DOWNLOADING https://dl.google.com/android/repository/fbad467867e935dce68a0296b00e6d1e76f15b15.platform-tools_r30.0.4-darwin.zip" - curl -s -f https://dl.google.com/android/repository/fbad467867e935dce68a0296b00e6d1e76f15b15.platform-tools_r30.0.4-darwin.zip -o platform-tools-darwin.zip - unzip -oq platform-tools-darwin.zip - ln -sf ./platform-tools/adb ./adb - chmod +x ./adb - ADB="./adb" - warning "PLEASE INSTALL adb from android-platform-tools to avoid this download in the future !!" - fi - #IF NOT ISNTALLED AND WSL INSTALL - if [ $OSTYPE == "WSL1" ]; then - warning "PLEASE INSTALL adb from android-platform-tools, WE WILL JUST DOWNLOAD LOCALLY FOR NOW, NO WORRIES !" - info "DOWNLOADING https://dl.google.com/android/repository/platform-tools_r30.0.4-linux.zip" - curl -s -f https://dl.google.com/android/repository/platform-tools_r30.0.4-linux.zip -o platform-tools-linux.zip - unzip -oq platform-tools-linux.zip - ln -sf ./platform-tools/adb ./adb - chmod +x ./adb - ADB="./adb" - warning "PLEASE INSTALL adb from android-platform-tools to avoid this download in the future !" - fi -fi +command -v sideload &> /dev/null && SIDELOUADINSTALLED=true +command -v sideload-gui &> /dev/null && GUIINSTALLED=true +command -v sideload-update &> /dev/null && UPDATEINSTALLED=true +command -v whitewhidow-mount &> /dev/null && MOUNTINSTALLED=true -#IS INSTALLED BUT WRONG VERSION INSTALL -if [ "$ADBGLOBALINSTALLED" == true ] && [ $OSTYPE == "WSL1" ] && [ "$($ADB --version | sed -n 2p)" != "Version 30.0.4-6686687" ]; then - error "" - error "WRONG VERSION OF LOCAL ADB DETECTED $($ADB --version | sed -n 2p)" - error "FOR USE WITH WSL1 PLEASE INSTALL adb (30.0.4) from android-platform-tools, OR REMOVE IT ALTOGETHER" - info "https://dl.google.com/android/repository/platform-tools_r30.0.4-linux.zip" - error "FOR UES WITH WSL1 PLEASE INSTALL adb (30.0.4) from android-platform-tools!" - exit +if [[ "$ADBINSTALLED" ]] && [[ "$AAPTINSTALLED" ]] && [[ "$RCLONEINSTALLED" ]] && [[ "$ZENITYINSTALLED" ]] && [[ "$UNZIPINSTALLED" ]] && [[ $(which sideload) == *"sideload"* ]] && [[ $(which sideload-gui) == *"sideload-gui"* ]] && [[ $(which sideload-update) == *"sideload-update"* ]]; then + ok 'All pakcages are present.' +else + error "You seem to be missing some packages, should we reinstall ?" + while true; do + read -p "(Yy/Nn) " yn + case $yn in + [Yy]* ) exec sideload-update;; + [Nn]* ) exit 0;; + * ) echo "Please answer yes or no.";; + esac + done + exit 1 fi -ok "LOCAL ADB $($ADB --version | sed -n 2p)" -ok "LOCAL ADB path set to: \"$ADB\"" + +ok "ADB path set to: \"$ADB\"" ## END ADB INSTALL ## AAPT INSTALL -info "LOCAL AAPT Detection" -if [[ $(which $AAPT) != *"error"* ]]; then - AAPTGLOBALINSTALLED=false -elif [[ $(which $AAPT) == *"$AAPT"* ]]; then - AAPTGLOBALINSTALLED=true -fi -if [ "$AAPTGLOBALINSTALLED" == false ]; then - if [ $OSTYPE == "Linux" ] || [ $OSTYPE == "WSL1" ]; then - warning "PLEASE INSTALL aapt from androidaapt.com, WE WILL JUST DOWNLOAD LOCALLY FOR NOW, NO WORRIES !" - info "DOWNLOADING https://dl.google.com/android/repository/build-tools_r28.0.2-linux.zip" - curl -s https://dl.google.com/android/repository/build-tools_r28.0.2-linux.zip -o build-tools_r28.0.2-linux.zip - unzip -oq build-tools_r28.0.2-linux.zip - ln -sf ./android-9/aapt ./aapt - chmod +x ./aapt - AAPT="./aapt" - warning "PLEASE INSTALL aapt from androidaapt.com to avoid this download in the future !!" - fi - if [ $OSTYPE == "Mac" ]; then +info "SEPERATE AAPT Detection" +if [ $OSTYPE == "mac" ]; then warning "PLEASE INSTALL aapt from androidaapt.com, WE WILL JUST DOWNLOAD LOCALLY FOR NOW, NO WORRIES !" info "DOWNLOADING https://raw.githubusercontent.com/whitewhidow/quest-sideloader-linux/main/mac_aapt_lib/aapt" curl -s https://raw.githubusercontent.com/whitewhidow/quest-sideloader-linux/main/mac_aapt_lib/aapt -o aapt chmod +x ./aapt AAPT="./aapt" warning "PLEASE INSTALL aapt from androidaapt.com to avoid this download in the future !!" - fi fi -ok "LOCAL AAPT path set to: \"$AAPT\"" +ok "AAPT path set to: \"$AAPT\"" ## END AAPT INSTALL @@ -199,8 +127,6 @@ ok "LOCAL AAPT path set to: \"$AAPT\"" - - #restart adb #$ADB kill-server 2> /dev/null #$ADB get-state 2> /dev/null @@ -218,7 +144,7 @@ then fi if [ "$DEVICECHECK" == 0 ] then - error "No device connected, make sure there is ONE adb connection (check using \"adb devices\")..$CI" + error "No device connected, make sure there is ONE adb connection (check using \"adb devices\")." [ -z $CI ] && exit 1 fi @@ -263,20 +189,6 @@ fi #aapt test and packagename setup -info "Testing aapt installation" -if ! command -v $AAPT &> /dev/null -then - error "aapt installation could not be found, please edit the aapt location in this file and restart, or enter the packagename manually below" - if [[ $SINGLEDIR == 1 ]] ; then - info "Packagename SUGGESTION BASED ON FOLDERNAME: ${BLUE}$SUGGESTION" - fi - info "" - error "PLEASE MANUALLY ENTER THE CORRECT PACKAGENAME (such as ${BLUE}com.oculus.HouseFlipperVR${BLUE} or ${BLUE}com.SDI.TWD${BLUE}) BELOW AND PRESS ENTER:" - printf " " - read PACKAGENAME - ok "Packagename SET AS : $PACKAGENAME" -else - if ([[ "$PWD" == *"ftp:host"* ]]); then info "FTP DETECTED, WILL COPY APK TO TMP, TO RUN AAPT, PLEASE WAIT A SEC" cp "$APKNAME" "/tmp/$APKNAME" @@ -292,7 +204,6 @@ else ok "Aapt installation found" ok "Package info auto-detected: \n${BLUE}$PACKAGEINFO" ok "Permissions auto-detected:\n${BLUE}$PACKAGEPERMS" -fi #end aapt test and packagename setup diff --git a/whitewhidow-mount.sh b/whitewhidow-mount.sh index d5ce41d..29cabb6 100755 --- a/whitewhidow-mount.sh +++ b/whitewhidow-mount.sh @@ -37,16 +37,18 @@ $(echo "$k" > $KLOC) sleep 1 +[ ! -z $CI ] && echo "::debug::Quiting early because of CI" && exit 0 + + +if [ $(rclone --config=$CLOC listremotes | wc -l) != "1" ]; then + echo -e "\nERROR\n\nSomething is wrong, we cannot seem to find the remote reason.\nif you report this at github.com/whitewhidow/quest-sideloader-linux, I will be happy to help\n\n" + read -p "$cr$cr Press [ENTER] to continue. $cr$cr" < "$(tty 0>&2)" + exit 1 +fi if [ $# -eq 0 ]; then #echo "Starting Rclone and gui" - if [ $(rclone --config=$CLOC listremotes | wc -l) != "1" ]; then - echo -e "\nERROR\n\nSomething is wrong, we cannot seem to start rclone for some reason.\nYf you report this at github.com/whitewhidow/quest-sideloader-linux, I will be happy to help" - read -p "$cr$cr Press [ENTER] to continue. $cr$cr" < "$(tty 0>&2)" - exit - fi - rclone rcd --rc-web-gui --rc-no-auth --config=$CLOC --rc-addr :0 & > /dev/null PID=$! @@ -63,6 +65,26 @@ else mkdir -p $MNTLOC REM=$(rclone --config=$CLOC listremotes) rclone mount --config=$CLOC $REM $MNTLOC & > /dev/null + + if [ $# -lt 2 ]; then + ##MOUNTCHECK + sleep 1 + echo "just 2 more seconds, to make sure rclone had time to mount.." + sleep 2 + FOLDER="/tmp/mnt/" + if [ ! "$(ls -A $FOLDER)" ]; then + echo "Still no mount, lets wait another 5.." + if [ ! "$(ls -A $FOLDER)" ]; then + echo -e "\nERROR\n\nSomething is wrong, the folder seems to return as empty.\nif you report this at www.github.com/whitewhidow/quest-sideloader-linux, I will be happy to help" + read -p "$cr$cr press [ENTER] to quit. $cr$cr" < "$(tty 0>&2)" + exit 1 + fi + + fi + echo -e "\n\n Drive now mounted at: $MNTLOC ($(ls $FOLDER | wc -l) folders available)\n\n" + ##MOUNTCHECK + fi + fi #clear