Skip to content

Commit f5b7a6a

Browse files
authored
Update binary copying for usage as root
If the script is being run as root, then the command `sudo` will not exist. This is also the case if it is being run within a docker image. Hence, there is a need to add a copy command that will work without `sudo`
1 parent 1751e31 commit f5b7a6a

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

build-ffmpeg

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ cd $PACKAGES/ffmpeg-6023b9f/ || exit
406406
execute make -j $MJOBS
407407
execute make install
408408

409-
INSTALL_FOLDER="/usr/bin"
409+
INSTALL_FOLDER="/usr/bin"
410410
if [[ "$OSTYPE" == "darwin"* ]]; then
411411
INSTALL_FOLDER="/usr/local/bin"
412412
fi
@@ -421,20 +421,25 @@ if [[ $AUTOINSTALL == "yes" ]]; then
421421
sudo cp "$WORKSPACE/bin/ffmpeg" "$INSTALL_FOLDER/ffmpeg"
422422
sudo cp "$WORKSPACE/bin/ffprobe" "$INSTALL_FOLDER/ffprobe"
423423
echo "Done. ffmpeg is now installed to your system"
424+
else
425+
cp "$WORKSPACE/bin/ffmpeg" "$INSTALL_FOLDER/ffmpeg"
426+
cp "$WORKSPACE/bin/ffprobe" "$INSTALL_FOLDER/ffprobe"
427+
echo "Done. ffmpeg is now installed to your system"
424428
fi
425429
elif [[ ! $SKIPINSTALL == "yes" ]]; then
426-
if command_exists "sudo"; then
427-
428-
read -r -p "Install the binary to your $INSTALL_FOLDER folder? [Y/n] " response
429-
430-
case $response in
431-
[yY][eE][sS]|[yY])
432-
sudo cp "$WORKSPACE/bin/ffmpeg" "$INSTALL_FOLDER/ffmpeg"
433-
sudo cp "$WORKSPACE/bin/ffprobe" "$INSTALL_FOLDER/ffprobe"
434-
echo "Done. ffmpeg is now installed to your system"
435-
;;
436-
esac
437-
fi
430+
read -r -p "Install the binary to your $INSTALL_FOLDER folder? [Y/n] " response
431+
case $response in
432+
[yY][eE][sS]|[yY])
433+
if command_exists "sudo"; then
434+
sudo cp "$WORKSPACE/bin/ffmpeg" "$INSTALL_FOLDER/ffmpeg"
435+
sudo cp "$WORKSPACE/bin/ffprobe" "$INSTALL_FOLDER/ffprobe"
436+
else
437+
cp "$WORKSPACE/bin/ffmpeg" "$INSTALL_FOLDER/ffmpeg"
438+
cp "$WORKSPACE/bin/ffprobe" "$INSTALL_FOLDER/ffprobe"
439+
fi
440+
echo "Done. ffmpeg is now installed to your system"
441+
;;
442+
esac
438443
fi
439444

440445
exit 0

0 commit comments

Comments
 (0)