mirror of
https://git.proxmox.com/git/fwupd
synced 2025-05-23 19:23:49 +00:00
39 lines
1.2 KiB
Bash
Executable File
39 lines
1.2 KiB
Bash
Executable File
#!/bin/bash -e
|
|
# Setup the repository.
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
# Add default vscode settings if not existing
|
|
SETTINGS_FILE=./.vscode/settings.json
|
|
SETTINGS_TEMPLATE_FILE=./contrib/vscode/settings.json
|
|
if [ ! -f "$SETTINGS_FILE" ]; then
|
|
mkdir ./.vscode
|
|
echo "Copy $SETTINGS_TEMPLATE_FILE to $SETTINGS_FILE."
|
|
cp "$SETTINGS_TEMPLATE_FILE" "$SETTINGS_FILE"
|
|
fi
|
|
|
|
#if interactive install build deps
|
|
if [ -n "$PS1" ] || [[ $- == *i* ]] || [ -f /dev/.cros_milestone ]; then
|
|
read -p "Install build dependencies? (y/n) " question
|
|
if [ "$question" = "y" ]; then
|
|
DEPS=$(./contrib/ci/generate_dependencies.py)
|
|
OS=$(python3 -c "import distro; print(distro.linux_distribution()[0].split()[0].lower())")
|
|
if [ "$OS" = "debian" ] || [ "$OS" = "ubuntu" ]; then
|
|
if ! python3 -c "import venv"; then
|
|
DEPS="python3-venv"
|
|
fi
|
|
sudo apt install $DEPS
|
|
elif [ "$OS" = "fedora" ]; then
|
|
sudo dnf install $DEPS
|
|
elif [ "$OS" = "arch" ]; then
|
|
pacman -Syu --noconfirm --needed $DEPS
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
python3 -m venv venv
|
|
source venv/bin/activate
|
|
|
|
python3 -m pip install pre-commit
|
|
pre-commit install
|