From 1840b9cdad08b5723f79b65fdf458c62f74bea71 Mon Sep 17 00:00:00 2001
From: "Igor Zalatov (from Citadel PC)" <flyrouter@gmail.com>
Date: Mon, 29 Aug 2022 15:44:41 +0300
Subject: [PATCH] Add stapler core script

---
 stapler | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100755 stapler

diff --git a/stapler b/stapler
new file mode 100755
index 0000000..01abb83
--- /dev/null
+++ b/stapler
@@ -0,0 +1,41 @@
+#!/bin/bash
+#
+# OpenIPC (c) | 2022.08.28
+
+# Autoupdate COMPOSER repo
+# Remove old building folder (full rebuild)
+# Download OpenIPC repo
+# Copy files from Projects Overlay
+# Build Firmware
+# Copy Kernel and Rootfs to TFTP server
+
+RELEASE=""
+PROJECT="$1"
+PROJECT="${PROJECT:=t31_vixand}"
+TFTPSRV="root@172.17.32.17:/mnt/bigger-2tb/Rotator/TFTP"
+
+
+echo_c() {
+    # 31 red, 32 green, 33 yellow, 34 blue, 35 magenta, 36 cyan, 37 white, 38 grey
+    t="\e[1;$1m$2\e[0m" || t="$2"
+    echo -e "$t"
+}
+
+2tftp() {
+  echo_c 32 "\nStart transferring files to the TFTP server...\n"
+  scp -r $@ ${TFTPSRV}
+}
+
+
+
+echo_c 32 "\nAttention, let's start working on the ${PROJECT} project...\n"
+git pull
+rm -rf Firmware
+git clone --depth=1 https://github.com/OpenIPC/firmware.git Firmware
+cp -afv Projects/${PROJECT}/* Firmware
+cd Firmware
+./building.sh ${PROJECT}
+echo_c 35 "\nYou can get the new assembled firmware components here:\n"
+tree -C output/images
+2tftp output/images/rootfs.squashfs.*  output/images/uImage.*
+cd -