refactor screen-share-sway

* introduce variables for common values
* properly quote variables
* check if directories exist before certain steps
* exit on cd failure
This commit is contained in:
surtur 2021-02-27 15:17:02 +01:00
parent 3eeb1e435e
commit ea2e7fb770
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

@ -5,13 +5,18 @@
grep -q "alias obs" ~/.zshrc || echo 'alias obs="QT_QPA_PLATFORM=xcb obs"' >> ~/.zshrc grep -q "alias obs" ~/.zshrc || echo 'alias obs="QT_QPA_PLATFORM=xcb obs"' >> ~/.zshrc
cd ~/utils V4L2_VERSION="0.12.5"
U="$HOME/utils"
dotfiles/bin/v4l2pls 0.12.5 # grab and build latest v4l2 module
"$U"/dotfiles/bin/v4l2pls "$V4L2_VERSION"
# ref: https://github.com/obsproject/obs-studio/wiki/Install-Instructions#red-hatfedora-based-build-directions # ref: https://github.com/obsproject/obs-studio/wiki/Install-Instructions#red-hatfedora-based-build-directions
git clone --recursive https://github.com/obsproject/obs-studio.git if [ ! -d "$U/obs-studio" ]; then
cd ~/utils/obs-studio cd "$U" || exit
git clone --recursive https://github.com/obsproject/obs-studio.git
fi
cd "$U"/obs-studio || exit
git pull git pull
git submodule update --recursive git submodule update --recursive
mkdir -pv build && cd build mkdir -pv build && cd build
@ -20,24 +25,26 @@ make -j4
sudo make install sudo make install
cd ~/utils if [ ! -d "$U/obs-v4l2sink" ]; then
cd "$U" || exit
git clone https://github.com/CatxFish/obs-v4l2sink.git git clone https://github.com/CatxFish/obs-v4l2sink.git
cd obs-v4l2sink fi
cd "$U"/obs-v4l2sink || exit
git pull git pull
mkdir -pv build && cd build mkdir -pv build && cd build
cmake -DLIBOBS_INCLUDE_DIR="../../obs-studio/libobs" -DCMAKE_INSTALL_PREFIX=~/.local .. cmake -DLIBOBS_INCLUDE_DIR="../../obs-studio/libobs" -DCMAKE_INSTALL_PREFIX=~/.local ..
make -j4 make -j4
make install make install
cd ~/utils/obs-v4l2sink
cd ~/utils
hg clone https://hg.sr.ht/~scoopta/wlrobs if [ ! -d "$U/wlrobs" ]; then
cd wlrobs cd "$U" || exit
hg clone https://hg.sr.ht/~scoopta/wlrobs
fi
cd "$U"/wlrobs || exit
hg pull hg pull
meson build meson --reconfigure build
ninja -C build ninja -C build
mkdir -pv ~/.config/obs-studio/plugins/wlrobs/bin/64bit mkdir -pv "$HOME"/.config/obs-studio/plugins/wlrobs/bin/64bit
cp -v build/libwlrobs.so ~/.config/obs-studio/plugins/wlrobs/bin/64bit cp -v build/libwlrobs.so "$HOME"/.config/obs-studio/plugins/wlrobs/bin/64bit