From 634c07606f816387f710d99137a44ea0acae5532 Mon Sep 17 00:00:00 2001 From: James Aaron Erang Date: Tue, 23 Apr 2024 19:11:59 +0800 Subject: [PATCH 1/9] fix spell err --- install.sh | 106 ++++++++++++++++++++++++++--------------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/install.sh b/install.sh index 38c1708..ec2354c 100644 --- a/install.sh +++ b/install.sh @@ -1,21 +1,21 @@ -#!/bin/bash +#!/bin/bash # If the install fails, then print an error and exit. function install_fail() { - echo "Installation failed" - exit 1 -} + echo "Installation failed" + exit 1 +} -# This is the help fuction. It helps users withe the options -function Help(){ - echo "Usage: install.sh [option]" - echo "Options:" - echo " -h: Show this help message and exit" - echo " -d: Install only dependencies" - echo " -p: Install only python dependencies (including playwright)" +# This is the help fuction. It helps users with the options +function Help(){ + echo "Usage: install.sh [option]" + echo "Options:" + echo " -h: Show this help message and exit" + echo " -d: Install only dependencies" + echo " -p: Install only python dependencies (including playwright)" echo " -b: Install just the bot" echo " -l: Install the bot and the python dependencies" -} +} # Options while getopts ":hydpbl" option; do @@ -42,7 +42,7 @@ while getopts ":hydpbl" option; do :) echo "Option -$OPTARG requires an argument." >&2 Help exit 1;; esac -done +done # Install dependencies for MacOS function install_macos(){ @@ -50,7 +50,7 @@ function install_macos(){ if [ ! command -v brew &> /dev/null ]; then echo "Installing Homebrew" # if it's is not installed, then install it in a NONINTERACTIVE way - NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" + NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" # Check for what arcitecture, so you can place path. if [[ "uname -m" == "x86_64" ]]; then echo "export PATH=/usr/local/bin:$PATH" >> ~/.bash_profile && source ~/.bash_profile @@ -61,7 +61,7 @@ function install_macos(){ echo "Homebrew is already installed" fi # Install the required packages - echo "Installing required Packages" + echo "Installing required Packages" if [! command --version python3 &> /dev/null ]; then echo "Installing python3" brew install python@3.10 @@ -69,72 +69,72 @@ function install_macos(){ echo "python3 already installed." fi brew install tcl-tk python-tk -} +} # Function to install for arch (and other forks like manjaro) -function install_arch(){ +function install_arch(){ echo "Installing required packages" sudo pacman -S --needed python3 tk git && python3 -m ensurepip unzip || install_fail -} +} # Function to install for debian (and ubuntu) -function install_deb(){ +function install_deb(){ echo "Installing required packages" sudo apt install python3 python3-dev python3-tk python3-pip unzip || install_fail -} +} # Function to install for fedora (and other forks) -function install_fedora(){ - echo "Installing required packages" +function install_fedora(){ + echo "Installing required packages" sudo dnf install python3 python3-tkinter python3-pip python3-devel unzip || install_fail -} +} # Function to install for centos (and other forks based on it) function install_centos(){ echo "Installing required packages" sudo yum install -y python3 || install_fail sudo yum install -y python3-tkinter epel-release python3-pip unzip|| install_fail -} +} -function get_the_bot(){ - echo "Downloading the bot" +function get_the_bot(){ + echo "Downloading the bot" rm -rf RedditVideoMakerBot-master curl -sL https://github.com/elebumm/RedditVideoMakerBot/archive/refs/heads/master.zip -o master.zip unzip master.zip rm -rf master.zip -} +} #install python dependencies -function install_python_dep(){ +function install_python_dep(){ # tell the user that the script is going to install the python dependencies - echo "Installing python dependencies" + echo "Installing python dependencies" # cd into the directory cd RedditVideoMakerBot-master # install the dependencies - pip3 install -r requirements.txt + pip3 install -r requirements.txt # cd out cd .. -} +} # install playwright function function install_playwright(){ - # tell the user that the script is going to install playwright + # tell the user that the script is going to install playwright echo "Installing playwright" # cd into the directory where the script is downloaded cd RedditVideoMakerBot-master # run the install script - python3 -m playwright install - python3 -m playwright install-deps + python3 -m playwright install + python3 -m playwright install-deps # give a note printf "Note, if these gave any errors, playwright may not be officially supported on your OS, check this issues page for support\nhttps://github.com/microsoft/playwright/issues" if [ -x "$(command -v pacman)" ]; then printf "It seems you are on and Arch based distro.\nTry installing these from the AUR for playwright to run:\nenchant1.6\nicu66\nlibwebp052\n" fi cd .. -} +} # Install depndencies -function install_deps(){ +function install_deps(){ # if the platform is mac, install macos if [ "$(uname)" == "Darwin" ]; then install_macos || install_fail @@ -164,30 +164,30 @@ https://github.com/elebumm/RedditVideoMakerBot" } # Main function -function install_main(){ +function install_main(){ # Print that are installing - echo "Installing..." - # if -y (assume yes) continue + echo "Installing..." + # if -y (assume yes) continue if [[ ASSUME_YES -eq 1 ]]; then echo "Assuming yes" # else, ask if they want to continue else - echo "Continue? (y/n)" - read answer + echo "Continue? (y/n)" + read answer # if the answer is not yes, then exit if [ "$answer" != "y" ]; then - echo "Aborting" + echo "Aborting" exit 1 fi - fi + fi # if the -d (only dependencies) options is selected install just the dependencies if [[ DEPS_ONLY -eq 1 ]]; then - echo "Installing only dependencies" + echo "Installing only dependencies" install_deps elif [[ PYTHON_ONLY -eq 1 ]]; then # if the -p (only python dependencies) options is selected install just the python dependencies and playwright - echo "Installing only python dependencies" - install_python_dep + echo "Installing only python dependencies" + install_python_dep install_playwright # if the -b (only the bot) options is selected install just the bot elif [[ JUST_BOT -eq 1 ]]; then @@ -200,9 +200,9 @@ function install_main(){ install_python_dep # else, install everything else - echo "Installing all" - install_deps - get_the_bot + echo "Installing all" + install_deps + get_the_bot install_python_dep install_playwright fi @@ -210,16 +210,16 @@ function install_main(){ DIR="./RedditVideoMakerBot-master" if [ -d "$DIR" ]; then printf "\nThe bot is installed, want to run it?" - # if -y (assume yes) continue + # if -y (assume yes) continue if [[ ASSUME_YES -eq 1 ]]; then echo "Assuming yes" # else, ask if they want to continue else - echo "Continue? (y/n)" - read answer + echo "Continue? (y/n)" + read answer # if the answer is not yes, then exit if [ "$answer" != "y" ]; then - echo "Aborting" + echo "Aborting" exit 1 fi fi From aea9193abacb848ee33ce68dfb13ab775e4a972e Mon Sep 17 00:00:00 2001 From: James Aaron Erang Date: Tue, 23 Apr 2024 19:13:45 +0800 Subject: [PATCH 2/9] change permission to +x --- install.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 install.sh diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 From 8cd9409fd1613a1ddcdb4b534734d7bc88d1f525 Mon Sep 17 00:00:00 2001 From: James Aaron Erang Date: Tue, 23 Apr 2024 19:14:11 +0800 Subject: [PATCH 3/9] use tab instead of spaces --- install.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index ec2354c..35dea61 100755 --- a/install.sh +++ b/install.sh @@ -6,15 +6,16 @@ function install_fail() { exit 1 } +# This is the help fuction. It helps users with the options # This is the help fuction. It helps users with the options function Help(){ echo "Usage: install.sh [option]" echo "Options:" - echo " -h: Show this help message and exit" - echo " -d: Install only dependencies" - echo " -p: Install only python dependencies (including playwright)" - echo " -b: Install just the bot" - echo " -l: Install the bot and the python dependencies" + echo -e "\t-h: Show this help message and exit" + echo -e "\t-d: Install only dependencies" + echo -e "\t-p: Install only python dependencies (including playwright)" + echo -e "\t-b: Install just the bot" + echo -e "\t-l: Install the bot and the python dependencies" } # Options From aa4519976d26b227705dfccf5706240ca056ceef Mon Sep 17 00:00:00 2001 From: James Aaron Erang Date: Tue, 23 Apr 2024 19:16:56 +0800 Subject: [PATCH 4/9] add space before { --- install.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/install.sh b/install.sh index 35dea61..c0f29ea 100755 --- a/install.sh +++ b/install.sh @@ -8,7 +8,7 @@ function install_fail() { # This is the help fuction. It helps users with the options # This is the help fuction. It helps users with the options -function Help(){ +function Help() { echo "Usage: install.sh [option]" echo "Options:" echo -e "\t-h: Show this help message and exit" @@ -46,7 +46,7 @@ while getopts ":hydpbl" option; do done # Install dependencies for MacOS -function install_macos(){ +function install_macos() { # Check if homebrew is installed if [ ! command -v brew &> /dev/null ]; then echo "Installing Homebrew" @@ -73,31 +73,31 @@ function install_macos(){ } # Function to install for arch (and other forks like manjaro) -function install_arch(){ +function install_arch() { echo "Installing required packages" sudo pacman -S --needed python3 tk git && python3 -m ensurepip unzip || install_fail } # Function to install for debian (and ubuntu) -function install_deb(){ +function install_deb() { echo "Installing required packages" sudo apt install python3 python3-dev python3-tk python3-pip unzip || install_fail } # Function to install for fedora (and other forks) -function install_fedora(){ +function install_fedora() { echo "Installing required packages" sudo dnf install python3 python3-tkinter python3-pip python3-devel unzip || install_fail } # Function to install for centos (and other forks based on it) -function install_centos(){ +function install_centos() { echo "Installing required packages" sudo yum install -y python3 || install_fail sudo yum install -y python3-tkinter epel-release python3-pip unzip|| install_fail } -function get_the_bot(){ +function get_the_bot() { echo "Downloading the bot" rm -rf RedditVideoMakerBot-master curl -sL https://github.com/elebumm/RedditVideoMakerBot/archive/refs/heads/master.zip -o master.zip @@ -106,7 +106,7 @@ function get_the_bot(){ } #install python dependencies -function install_python_dep(){ +function install_python_dep() { # tell the user that the script is going to install the python dependencies echo "Installing python dependencies" # cd into the directory @@ -118,7 +118,7 @@ function install_python_dep(){ } # install playwright function -function install_playwright(){ +function install_playwright() { # tell the user that the script is going to install playwright echo "Installing playwright" # cd into the directory where the script is downloaded @@ -135,7 +135,7 @@ function install_playwright(){ } # Install depndencies -function install_deps(){ +function install_deps() { # if the platform is mac, install macos if [ "$(uname)" == "Darwin" ]; then install_macos || install_fail @@ -165,7 +165,7 @@ https://github.com/elebumm/RedditVideoMakerBot" } # Main function -function install_main(){ +function install_main() { # Print that are installing echo "Installing..." # if -y (assume yes) continue From d490b24e3df7b5bb77531aacad0b8e7a8643fd20 Mon Sep 17 00:00:00 2001 From: James Aaron Erang Date: Tue, 23 Apr 2024 19:20:14 +0800 Subject: [PATCH 5/9] install pipx as dependeny --- install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index c0f29ea..ce3f46b 100755 --- a/install.sh +++ b/install.sh @@ -75,26 +75,26 @@ function install_macos() { # Function to install for arch (and other forks like manjaro) function install_arch() { echo "Installing required packages" - sudo pacman -S --needed python3 tk git && python3 -m ensurepip unzip || install_fail + sudo pacman -S --needed python3 python-pipx tk git && python3 -m ensurepip unzip || install_fail } # Function to install for debian (and ubuntu) function install_deb() { echo "Installing required packages" - sudo apt install python3 python3-dev python3-tk python3-pip unzip || install_fail + sudo apt install python3 pipx python3-dev python3-tk python3-pip unzip || install_fail } # Function to install for fedora (and other forks) function install_fedora() { echo "Installing required packages" - sudo dnf install python3 python3-tkinter python3-pip python3-devel unzip || install_fail + sudo dnf install python3 pipx python3-tkinter python3-pip python3-devel unzip || install_fail } # Function to install for centos (and other forks based on it) function install_centos() { echo "Installing required packages" sudo yum install -y python3 || install_fail - sudo yum install -y python3-tkinter epel-release python3-pip unzip|| install_fail + sudo yum install -y python3-tkinter pipx epel-release python3-pip unzip|| install_fail } function get_the_bot() { From 9becf7a5da66a5409d8b2875e0564e7417e67095 Mon Sep 17 00:00:00 2001 From: James Aaron Erang Date: Tue, 23 Apr 2024 19:21:35 +0800 Subject: [PATCH 6/9] use pipx instead of pip3 --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index ce3f46b..c2d1a7c 100755 --- a/install.sh +++ b/install.sh @@ -112,7 +112,7 @@ function install_python_dep() { # cd into the directory cd RedditVideoMakerBot-master # install the dependencies - pip3 install -r requirements.txt + pipx install -r requirements.txt # cd out cd .. } From 44fa6379882ed616c45671708115ed74316de06d Mon Sep 17 00:00:00 2001 From: James Aaron Erang Date: Fri, 26 Apr 2024 08:00:47 +0800 Subject: [PATCH 7/9] avoid cd in and out, loop through the file and install all the dependencies using pipx individually --- install.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index c2d1a7c..e688252 100755 --- a/install.sh +++ b/install.sh @@ -109,12 +109,13 @@ function get_the_bot() { function install_python_dep() { # tell the user that the script is going to install the python dependencies echo "Installing python dependencies" - # cd into the directory - cd RedditVideoMakerBot-master # install the dependencies - pipx install -r requirements.txt - # cd out - cd .. + DEP_LIST=./RedditVideoMakerBot-master/requirements.txt + if [[ -f $DEP_LIST ]]; then + while read -r DEPS; do + pipx install $DEPS + done < "$DEP_LIST" + fi } # install playwright function From 44de7b887568db3743a34026ff102eae20345df5 Mon Sep 17 00:00:00 2001 From: James Aaron Erang Date: Mon, 13 May 2024 13:56:32 +0800 Subject: [PATCH 8/9] fix arch error --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index e688252..4e51b51 100755 --- a/install.sh +++ b/install.sh @@ -75,7 +75,8 @@ function install_macos() { # Function to install for arch (and other forks like manjaro) function install_arch() { echo "Installing required packages" - sudo pacman -S --needed python3 python-pipx tk git && python3 -m ensurepip unzip || install_fail + sudo pacman -S --needed python3 python-pipx tk git unzip + python -m ensurepip || install_fail } # Function to install for debian (and ubuntu) @@ -93,8 +94,7 @@ function install_fedora() { # Function to install for centos (and other forks based on it) function install_centos() { echo "Installing required packages" - sudo yum install -y python3 || install_fail - sudo yum install -y python3-tkinter pipx epel-release python3-pip unzip|| install_fail + sudo yum install -y python3-tkinter pipx epel-release python3-pip unzip python3 || install_fail } function get_the_bot() { From 4e3cc3b893c65884d72a1cd5000c26aac7dfbcbb Mon Sep 17 00:00:00 2001 From: James Aaron Erang Date: Tue, 14 May 2024 09:17:06 +0800 Subject: [PATCH 9/9] use pipx to install playwright Co-authored-by: Cyteon <129582290+Cyteon@users.noreply.github.com> --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 4e51b51..bf2510c 100755 --- a/install.sh +++ b/install.sh @@ -125,8 +125,8 @@ function install_playwright() { # cd into the directory where the script is downloaded cd RedditVideoMakerBot-master # run the install script - python3 -m playwright install - python3 -m playwright install-deps + pipx run playwright install + pipx run playwright install-deps # give a note printf "Note, if these gave any errors, playwright may not be officially supported on your OS, check this issues page for support\nhttps://github.com/microsoft/playwright/issues" if [ -x "$(command -v pacman)" ]; then