You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.6 KiB
55 lines
1.6 KiB
7 years ago
|
#!/bin/bash
|
||
|
#
|
||
|
# Create/update TDE local debian repository
|
||
|
#
|
||
|
|
||
|
# Load common code and initialization
|
||
7 years ago
|
. ./internals/_build_common.sh
|
||
7 years ago
|
init_common
|
||
|
|
||
|
#----------------------------
|
||
|
# Check command line arguments
|
||
|
parm_MAKE_BACKUP="n"
|
||
|
for arg in $@; do
|
||
|
if [ "$arg" = "-b" ]; then # backup old repository
|
||
|
parm_MAKE_BACKUP="y"
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
|
||
|
#----------------------------
|
||
|
# Create/update TDE local debian repository
|
||
|
echo -e "${CLightCyan}#### TDE local repository creation begin ####${CNone}"
|
||
7 years ago
|
ARCH_PATH="dists/$DISTRO_NAME/main/binary-$ARCHITECTURE"
|
||
7 years ago
|
REPO_DIR="$TDE_DIR/$CFG_REPO_DIR"
|
||
|
REPO_DIR_BACKUP="$REPO_DIR.backup"
|
||
|
REPO_PKG_DIR="$REPO_DIR/$ARCH_PATH"
|
||
|
|
||
|
# Backup
|
||
|
if [ "$parm_MAKE_BACKUP" = "y" ] && [ -d "$REPO_DIR" ]; then
|
||
|
echo -e "${CYellow}> Backing up old repository${CNone}"
|
||
|
rm -R "$REPO_DIR_BACKUP" &>/dev/null
|
||
|
mv "$REPO_DIR" "$REPO_DIR_BACKUP" &>/dev/null
|
||
|
echo "Copy of the old repository available at \"$REPO_DIR_BACKUP\""
|
||
|
fi
|
||
|
|
||
|
# Create repository
|
||
|
echo -e "${CYellow}> Creating new repository${CNone}"
|
||
|
if [ -d "$REPO_DIR" ]; then
|
||
|
rm -R "$REPO_DIR" &>/dev/null
|
||
|
fi
|
||
|
mkdir -p "$REPO_PKG_DIR"
|
||
7 years ago
|
rsync -aHS --exclude="*/src/*.xz" --exclude="*/src/*.dsc" --exclude="*/src/*.changes" --exclude="*/src/*.buildinfo" --exclude="Packages*" "$TDE_DEBS_DIR/" "$REPO_PKG_DIR/"
|
||
7 years ago
|
|
||
|
# Create package index file
|
||
|
echo -e "${CYellow}> Creating package index file${CNone}"
|
||
|
cd "$REPO_DIR"
|
||
|
dpkg-scanpackages "./$ARCH_PATH" | gzip -9c > "./$ARCH_PATH/Packages.gz"
|
||
|
|
||
|
|
||
|
#----------------------------
|
||
|
# Repository created
|
||
|
echo -e "${CLightGreen}#### TDE local repository created ####${CNone}"
|
||
|
cd "$SCRIPT_DIR"
|
||
|
exit 0
|