I've made a zsh script to automate the installation. Note that there is an error with pkgbuild that I fixed using dos2unix. The main reason of this script is to use FULL HD resolution:
#
# Installs and configures Droidcam from the AUR, with the resolution modified to 1080p.
#
# USAGE:
# install_droidcam
#
# WHAT IT DOES:
# 1. Creates a safe, temporary working directory.
# 2. Checks for and installs the 'dos2unix' dependency if needed.
# 3. Downloads the Droidcam build files from the AUR.
# 4. Uses 'sed' to change the resolution to 1920x1080 in the PKGBUILD.
# 5. Fixes the file format (dos2unix) to prevent errors.
# 6. Updates checksums (updpkgsums) to ensure validation.
# 7. Compiles and installs the package non-interactively (makepkg -si --noconfirm).
# 8. Loads the kernel module with the new settings.
# 9. Cleans up the temporary working directory upon completion.
#
install_droidcam() {
# Stop the script if any command fails
set -e
# Create a safe temporary directory to avoid cluttering the home folder
local build_dir
build_dir=$(mktemp -d -t droidcam-build-XXXXXX)
echo ">>> Using temporary build directory: ${build_dir}"
# Ensure the temporary directory is removed on exit, even on error
trap 'echo ">>> Cleaning up build directory..."; rm -rf -- "$build_dir"' EXIT
# Enter the temporary directory
cd "$build_dir"
echo -e "\n[ STEP 1/7 ] Checking for 'dos2unix' dependency..."
if ! command -v dos2unix &> /dev/null; then
echo "--> 'dos2unix' not found. Installing via pacman..."
sudo pacman -S --noconfirm dos2unix
else
echo "--> 'dos2unix' is already installed."
fi
echo -e "\n[ STEP 2/7 ] Downloading Droidcam files (AUR)..."
paru -G droidcam
# Enter the package directory
cd droidcam
echo -e "\n[ STEP 3/7 ] Modifying PKGBUILD for 1920x1080 resolution..."
sed -i 's/width=640 height=480/width=1920 height=1080/g' PKGBUILD
echo "--> Modification complete."
echo -e "\n[ STEP 4/7 ] Correcting file format (dos2unix)..."
dos2unix PKGBUILD
echo -e "\n[ STEP 5/7 ] Updating checksums in PKGBUILD..."
updpkgsums
echo -e "\n[ STEP 6/7 ] Building and installing the package (may ask for your password)..."
makepkg -si --noconfirm
echo -e "\n[ STEP 7/7 ] Loading the kernel module (may ask for your password)..."
sudo modprobe -v v4l2loopback_dc
# The 'trap' will handle the cleanup
set +e
echo -e "\n✅ Process complete! Droidcam has been successfully installed and configured."
}
Pinned Comments