summaryrefslogtreecommitdiffstats
path: root/debian/_buildscripts/local/scripts/create_repo.sh
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2018-02-11 21:58:16 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2018-05-28 14:46:58 +0900
commit80b6864a4cd886534f4158130e3c4ef450943ade (patch)
tree63761e7cb3d68d4c816d97926ee0487bbe6bc720 /debian/_buildscripts/local/scripts/create_repo.sh
parentf7fed43409d307ee2606ddc32c6e5cab3caf4ef8 (diff)
downloadtde-packaging-80b6864a4cd886534f4158130e3c4ef450943ade.tar.gz
tde-packaging-80b6864a4cd886534f4158130e3c4ef450943ade.zip
DEB build script: added "create_repo" script. Prevent scripts from being
run from tde-packaging git repo, to make sure the user follows the instructions provided. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'debian/_buildscripts/local/scripts/create_repo.sh')
-rwxr-xr-xdebian/_buildscripts/local/scripts/create_repo.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/debian/_buildscripts/local/scripts/create_repo.sh b/debian/_buildscripts/local/scripts/create_repo.sh
new file mode 100755
index 000000000..3fc2f0238
--- /dev/null
+++ b/debian/_buildscripts/local/scripts/create_repo.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+#
+# Create/update TDE local debian repository
+#
+
+# Load common code and initialization
+. ./_build_common.sh
+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}"
+ARCH_PATH="dists/$D_VERSION/main/binary-$ARCHITECTURE"
+REPO_DIR="$TDE_DIR/$CFG_REPO_DIR"
+REPO_DIR_BACKUP="$REPO_DIR.backup"
+REPO_PKG_DIR="$REPO_DIR/$ARCH_PATH"
+TDE_DEBS_DIR="$TDE_DIR/$CFG_TDE_DEBS_DIR"
+
+# 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"
+rsync -aHS --exclude="*/src/*.xz" --exclude="*/src/*.dsc" --exclude="*/src/*.changes" --exclude="Packages*" "$TDE_DEBS_DIR/" "$REPO_PKG_DIR/"
+
+# 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