forked from perfsonar/debian-docker-buildmachines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathps-local-repo
executable file
·25 lines (21 loc) · 897 Bytes
/
ps-local-repo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
# This script configures a local APT repository to use locally built packages.
# This is mostly useful in a development setup.
# It needs to be given an argument, the absolut path to the directory where the repository exists.
if [ $# -gt 0 ]; then
LOCAL_REPO=$1
else
echo "Where is the local repository located?"
exit 1
fi
# The script can be run as root or as a user with sudo access
# We might not know if sudo is actually insalled or not
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
SUDO="sudo"
else
SUDO=""
fi
echo "To solve dependencies, I will also use packages from ${LOCAL_REPO} if any."
echo "# Using locally built packages" | $SUDO tee /etc/apt/sources.list.d/localy-built-packages.list > /dev/null
echo "deb [trusted=yes] file:${LOCAL_REPO} ./" | $SUDO tee -a /etc/apt/sources.list.d/localy-built-packages.list > /dev/null
$SUDO apt-get -qy update