diff options
author | Guy Sheffer <guysoft@gmail.com> | 2021-07-02 21:58:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-02 21:58:53 +0300 |
commit | d2cc74aa233f87b20dfb1c949d55d92fdd55755c (patch) | |
tree | 989ad9930fbe08480b7c57d72e0ce8eff6f73af1 | |
parent | 0c6a3cf599a9abe7615be0f4f0ae81e4040aaf34 (diff) | |
parent | 9e473f14ad5e04c9dd6e5f4f4373860a26d25e46 (diff) |
Merge pull request #743 from foosel/fix-mjpgstreamer-location
🐛 Remove mjpg-streamer from pi home and relocate to /opt/mjpg-streamer
-rwxr-xr-x | src/modules/octopi/config | 5 | ||||
-rwxr-xr-x | src/modules/octopi/filesystem/home/root/bin/webcamd | 2 | ||||
-rwxr-xr-x | src/modules/octopi/start_chroot_script | 42 |
3 files changed, 30 insertions, 19 deletions
diff --git a/src/modules/octopi/config b/src/modules/octopi/config index e9f3d06..4387161 100755 --- a/src/modules/octopi/config +++ b/src/modules/octopi/config @@ -12,10 +12,7 @@ [ -n "$OCTOPI_INCLUDE_CURAENGINE" ] || OCTOPI_INCLUDE_CURAENGINE=no # mjpg streamer -[ -n "$OCTOPI_MJPGSTREAMER_REPO_SHIP" ] || OCTOPI_MJPGSTREAMER_REPO_SHIP=https://github.com/jacksonliam/mjpg-streamer.git -[ -n "$OCTOPI_MJPGSTREAMER_REPO_BUILD" ] || OCTOPI_MJPGSTREAMER_REPO_BUILD= -[ -n "$OCTOPI_MJPGSTREAMER_REPO_BRANCH" ] || OCTOPI_MJPGSTREAMER_REPO_BRANCH=master -[ -n "$OCTOPI_MJPGSTREAMER_REPO_DEPTH" ] || OCTOPI_MJPGSTREAMER_REPO_DEPTH=1 +[ -n "$OCTOPI_MJPGSTREAMER_ARCHIVE" ] || OCTOPI_MJPGSTREAMER_ARCHIVE=https://github.com/jacksonliam/mjpg-streamer/archive/master.zip [ -n "$OCTOPI_INCLUDE_MJPGSTREAMER" ] || OCTOPI_INCLUDE_MJPGSTREAMER=yes # FFMPEG HLS diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index 8a01a40..f2c6dfb 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -11,7 +11,7 @@ ### computer. ### ######################################################################## -MJPGSTREAMER_HOME=/home/pi/mjpg-streamer +MJPGSTREAMER_HOME=/opt/mjpg-streamer MJPGSTREAMER_INPUT_USB="input_uvc.so" MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so" diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 1b905a8..e57442a 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -59,7 +59,8 @@ pushd /home/"${BASE_USER}" #mjpg-streamer if [ "$OCTOPI_INCLUDE_MJPGSTREAMER" == "yes" ] then - echo "--- Installing mjpg-streamer" + install_dir=/opt/mjpg-streamer + echo "--- Installing mjpg-streamer to $install_dir" if [ $( is_in_apt libjpeg62-turbo-dev ) -eq 1 ]; then apt-get -y --force-yes install libjpeg62-turbo-dev elif [ $( is_in_apt libjpeg8-dev ) -eq 1 ]; then @@ -67,26 +68,35 @@ pushd /home/"${BASE_USER}" fi apt-get -y --force-yes --no-install-recommends install imagemagick ffmpeg libv4l-dev - gitclone OCTOPI_MJPGSTREAMER_REPO mjpg-streamer - pushd mjpg-streamer - mv mjpg-streamer-experimental/* . + wget $OCTOPI_MJPGSTREAMER_ARCHIVE -O mjpg-streamer.zip + unzip mjpg-streamer.zip + rm mjpg-streamer.zip + + pushd mjpg-streamer-master/mjpg-streamer-experimental # As said in Makefile, it is just a wrapper around CMake. # To apply -j option, we have to unwrap it. - MJPG_STREAMER_BUILD_DIR=_build - [ -d ${MJPG_STREAMER_BUILD_DIR} ] || (mkdir ${MJPG_STREAMER_BUILD_DIR} && \ - chown "${BASE_USER}:${BASE_USER}" ${MJPG_STREAMER_BUILD_DIR}) - [ -f ${MJPG_STREAMER_BUILD_DIR}/Makefile ] || (cd ${MJPG_STREAMER_BUILD_DIR} && \ - sudo -u "${BASE_USER}" cmake -DCMAKE${MJPG_STREAMER_BUILD_DIR}_TYPE=Release ..) + build_dir=_build + mkdir -p $build_dir + pushd $build_dir + cmake -DCMAKE_BUILD_TYPE=Release .. + popd + + make -j $(nproc) -C $build_dir - sudo -u "${BASE_USER}" make -j $(nproc) -C ${MJPG_STREAMER_BUILD_DIR} + mkdir -p $install_dir - sudo -u "${BASE_USER}" cp ${MJPG_STREAMER_BUILD_DIR}/mjpg_streamer . - sudo -u "${BASE_USER}" find ${MJPG_STREAMER_BUILD_DIR} -name "*.so" -type f -exec cp {} . \; + install -m 755 $build_dir/mjpg_streamer $install_dir + find $build_dir -name "*.so" -type f -exec install -m 644 {} $install_dir \; + + # copy bundled web folder + cp -a -r ./www $install_dir + chmod 755 $install_dir/www + chmod -R 644 $install_dir/www # create our custom web folder and add a minimal index.html to it - sudo -u "${BASE_USER}" mkdir www-octopi - pushd www-octopi + mkdir $install_dir/www-octopi + pushd $install_dir/www-octopi cat <<EOT >> index.html <html> <head><title>mjpg_streamer test page</title></head> @@ -101,6 +111,10 @@ pushd /home/"${BASE_USER}" EOT popd popd + rm -rf mjpg-streamer-master + + # symlink for backwards compatibility + sudo -u "${BASE_USER}" ln -s $install_dir /home/"${BASE_USER}"/mjpg-streamer fi # FFMPEG HLS |