Skip to content

Commit

Permalink
Merge pull request popcorn-official#3019 from wiryhatbox/update-script
Browse files Browse the repository at this point in the history
  • Loading branch information
kiriles90 authored Jun 27, 2024
2 parents c9bfece + 24a70a8 commit 3b254f7
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions make_popcorn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,21 @@ else
fi

clone_command() {
if git clone "$clone_url" "$dir"; then
if git clone -- "$clone_url" "$dir"; then
echo "Cloned Popcorn Time successfully"
else
echo "Popcorn Time encountered an error and could not be cloned"
exit 2
fi
}

if [ -e ".git/config" ]; then
dat="$(grep url .git/config)"
git_dir="$(git rev-parse --git-dir 2>/dev/null)" || git_dir=".git"
if [ -e "$git_dir"/config ]; then
dat="$(grep -- url "$git_dir"/config)"
case "$dat" in *popcorn*)
echo "You appear to be inside of a Popcorn Time repository already, not cloning"
clone_repo="False"
cd -- "$(dirname "$git_dir")" # otherwise yarn build might fail
;;
*)
try="True"
Expand Down Expand Up @@ -67,7 +69,7 @@ if [ -e ".git/config" ]; then
fi
if [ "$clone_repo" = "True" ]; then
echo "Cloning Popcorn Time"
read -r -p "Where do you wish to clone Popcorn Time to? [popcorn] " dir
read -p "Where do you wish to clone Popcorn Time to? [popcorn] " dir
if [ -z "$dir" ]; then
dir='popcorn'
elif [ "$dir" = "/" ]; then
Expand Down Expand Up @@ -98,7 +100,10 @@ if [ "$clone_repo" = "True" ]; then
echo "Removing old directory"
if [ "$dir" != "." ] || [ "$dir" != "$PWD" ]; then
echo "Cleaning up from inside the destination directory"
rm -rf "$dir"
if ! rm -rf -- "$dir"; then
echo "Cannot delete the directory"
exit 4
fi
fi
clone_command
else
Expand All @@ -110,7 +115,9 @@ fi
if [ -z "$dir" ]; then
dir="."
fi
cd "$dir"

cd -- "$dir"

echo "Switched to $PWD"

if [ "$rd_dep" = "yes" ]; then
Expand All @@ -124,7 +131,7 @@ fi

if yarn build; then
echo "Popcorn Time built successfully!"
if [[ "$(uname -s)" != *"NT"* ]]; then # if not windows
if [[ ! "$(uname -s)" =~ "NT" ]]; then # if not windows
./Create-Desktop-Entry
fi
echo "Run 'yarn start' to launch the app or run Popcorn-Time from the ./build folder..."
Expand Down

0 comments on commit 3b254f7

Please sign in to comment.