mirror of https://github.com/OpenIPC/composer.git
Sync of stapler
parent
2a92e0d41a
commit
44433c79ef
102
stapler
102
stapler
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# OpenIPC (c) | version 2022.09.12
|
# OpenIPC | version 2022.11.15
|
||||||
|
|
||||||
# Autoupdate COMPOSER repo
|
# Autoupdate COMPOSER repo
|
||||||
# Remove old building folder (for full rebuild)
|
# Remove old building folder (for full rebuild)
|
||||||
|
@ -10,10 +10,16 @@
|
||||||
# Copy Kernel and Rootfs to Archive
|
# Copy Kernel and Rootfs to Archive
|
||||||
# Copy Kernel and Rootfs to TFTP server
|
# Copy Kernel and Rootfs to TFTP server
|
||||||
|
|
||||||
PROJECT="$1"
|
|
||||||
TFTPSRV="root@172.17.32.17:/mnt/bigger-2tb/Rotator/TFTP"
|
|
||||||
OUTTIME=$(date +"%Y%m%d")
|
|
||||||
|
|
||||||
|
RELEASE=""
|
||||||
|
PROJECT="$1"
|
||||||
|
|
||||||
|
TFTP_STORAGE="root@172.17.32.17:/mnt/bigger-2tb/Rotator/TFTP"
|
||||||
|
|
||||||
|
COMPOSER_DIR=$(pwd)
|
||||||
|
FIRMWARE_DIR="${COMPOSER_DIR}/openipc"
|
||||||
|
TIMESTAMP=$(date +"%Y%m%d")
|
||||||
|
VERSION=$(stat -c"%Y" $0)
|
||||||
|
|
||||||
echo_c() {
|
echo_c() {
|
||||||
# 30 grey, 31 red, 32 green, 33 yellow, 34 blue, 35 magenta, 36 cyan, 37 white
|
# 30 grey, 31 red, 32 green, 33 yellow, 34 blue, 35 magenta, 36 cyan, 37 white
|
||||||
|
@ -21,37 +27,75 @@ echo_c() {
|
||||||
echo -e "$t"
|
echo -e "$t"
|
||||||
}
|
}
|
||||||
|
|
||||||
2archive() {
|
copy_to_archive() {
|
||||||
mkdir -p ../archive/${PROJECT}_${OUTTIME}
|
echo_c 32 "Copy files to archive"
|
||||||
cp -a output/images/autoupdate* output/images/rootfs.squashfs.* output/images/uImage.* output/images/*.tar ../archive/${PROJECT}_${OUTTIME}
|
mkdir -p "${COMPOSER_DIR}/archive/${PROJECT}_${TIMESTAMP}"
|
||||||
echo_c 35 "\nYou can get the new assembled firmware components here:\n"
|
cp -a \
|
||||||
tree -C ../archive/${PROJECT}_${OUTTIME}
|
${FIRMWARE_DIR}/output/images/autoupdate* \
|
||||||
|
${FIRMWARE_DIR}/output/images/rootfs.squashfs.* \
|
||||||
|
${FIRMWARE_DIR}/output/images/uImage.* \
|
||||||
|
${FIRMWARE_DIR}/output/images/*.tar \
|
||||||
|
${COMPOSER_DIR}/archive/${PROJECT}_${TIMESTAMP}
|
||||||
|
|
||||||
|
echo_c 35 "\nAssembled firmware available in:"
|
||||||
|
tree -C "${COMPOSER_DIR}/archive/${PROJECT}_${TIMESTAMP}"
|
||||||
}
|
}
|
||||||
|
|
||||||
2tftp() {
|
copy_to_tftp() {
|
||||||
echo_c 32 "\nStart transferring files to the TFTP server ...\n"
|
echo_c 32 "\nCopy files to TFTP server"
|
||||||
scp -r output/images/autoupdate* output/images/rootfs.squashfs.* output/images/uImage.* ${TFTPSRV}
|
scp -r ${FIRMWARE_DIR}/output/images/autoupdate* \
|
||||||
|
${FIRMWARE_DIR}/output/images/rootfs.squashfs.* \
|
||||||
|
${FIRMWARE_DIR}/output/images/uImage.* \
|
||||||
|
${TFTP_STORAGE}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
select_project() {
|
||||||
|
AVAILABLE_PROJECTS=$(ls -1 ${COMPOSER_DIR}/projects)
|
||||||
|
cmd="whiptail --title \"Available projects\" --menu \"Please select a project from the list below:\" 25 78 16"
|
||||||
|
for p in $AVAILABLE_PROJECTS; do cmd="${cmd} \"$p\" \"\""; done
|
||||||
|
PROJECT=$(eval "${cmd} 3>&1 1>&2 2>&3")
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
echo_c 31 "Cancelled."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [ -z ${PROJECT} ]; then
|
echo_c 37 "COMPOSER - custom OpenIPC firmware builder"
|
||||||
echo_c 31 "\nPlease specify one project from the list at the command line:\n"
|
echo_c 30 "https://openipc.org/"
|
||||||
tree -L 1 projects
|
echo_c 30 "Version: ${VERSION}"
|
||||||
|
|
||||||
|
while [ -z "${PROJECT}" ]; do select_project; done
|
||||||
|
|
||||||
|
echo_c 31 "\nStarting a project for ${PROJECT}"
|
||||||
|
tree -C ${COMPOSER_DIR}/projects/${PROJECT}
|
||||||
|
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
echo_c 33 "\nUpdating Composer"
|
||||||
|
git pull
|
||||||
|
|
||||||
|
# rm -rf openipc
|
||||||
|
if [ ! -d "$FIRMWARE_DIR" ]; then
|
||||||
|
echo_c 33 "\nDownloading Firmware"
|
||||||
|
git clone --depth=1 https://github.com/OpenIPC/firmware.git "$FIRMWARE_DIR"
|
||||||
|
cd "$FIRMWARE_DIR"
|
||||||
else
|
else
|
||||||
echo_c 31 "\nAttention, let's start working on the ${PROJECT} project ...\n"
|
echo_c 33 "\nUpdating Firmware"
|
||||||
tree -C projects/${PROJECT}; sleep 3
|
cd "$FIRMWARE_DIR"
|
||||||
echo_c 33 "\nSync of Composer repo ...\n"
|
# git reset HEAD --hard
|
||||||
git pull
|
# git pull --rebase
|
||||||
echo_c 33 "\nDownload Firmware repo ...\n"
|
|
||||||
rm -rf openipc
|
|
||||||
git clone --depth=1 https://github.com/OpenIPC/firmware.git openipc
|
|
||||||
cd openipc
|
|
||||||
cp -afv ../projects/${PROJECT}/* .
|
|
||||||
cp -afv ../packages/* ./general/package
|
|
||||||
./building.sh ${PROJECT}
|
|
||||||
2archive; 2tftp
|
|
||||||
echo_c 35 "\nRollback to home ...\n"
|
|
||||||
cd -
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo_c 33 "\nCopying extra packages"
|
||||||
|
cp -afv ${COMPOSER_DIR}/packages/* ${FIRMWARE_DIR}/general/package
|
||||||
|
|
||||||
|
echo_c 33 "\nCopying project files"
|
||||||
|
cp -afv ${COMPOSER_DIR}/projects/${PROJECT}/* ${FIRMWARE_DIR}
|
||||||
|
|
||||||
|
echo_c 33 "\nBuilding the project"
|
||||||
|
./building.sh ${PROJECT}
|
||||||
|
|
||||||
|
copy_to_archive
|
||||||
|
copy_to_tftp
|
||||||
|
echo_c 35 "\nDone"
|
||||||
|
cd "$COMPOSER_DIR"
|
||||||
|
|
101
stapler_new
101
stapler_new
|
@ -1,101 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# OpenIPC | version 2022.11.15
|
|
||||||
|
|
||||||
# Autoupdate COMPOSER repo
|
|
||||||
# Remove old building folder (for full rebuild)
|
|
||||||
# Download OpenIPC repo
|
|
||||||
# Copy files from Project Overlay
|
|
||||||
# Build Firmware
|
|
||||||
# Copy Kernel and Rootfs to Archive
|
|
||||||
# Copy Kernel and Rootfs to TFTP server
|
|
||||||
|
|
||||||
|
|
||||||
RELEASE=""
|
|
||||||
PROJECT="$1"
|
|
||||||
|
|
||||||
TFTP_STORAGE="root@172.17.32.17:/mnt/bigger-2tb/Rotator/TFTP"
|
|
||||||
|
|
||||||
COMPOSER_DIR=$(pwd)
|
|
||||||
FIRMWARE_DIR="${COMPOSER_DIR}/openipc"
|
|
||||||
TIMESTAMP=$(date +"%Y%m%d")
|
|
||||||
VERSION=$(stat -c"%Y" $0)
|
|
||||||
|
|
||||||
echo_c() {
|
|
||||||
# 30 grey, 31 red, 32 green, 33 yellow, 34 blue, 35 magenta, 36 cyan, 37 white
|
|
||||||
t="\e[1;$1m$2\e[0m" || t="$2"
|
|
||||||
echo -e "$t"
|
|
||||||
}
|
|
||||||
|
|
||||||
copy_to_archive() {
|
|
||||||
echo_c 32 "Copy files to archive"
|
|
||||||
mkdir -p "${COMPOSER_DIR}/archive/${PROJECT}_${TIMESTAMP}"
|
|
||||||
cp -a \
|
|
||||||
${FIRMWARE_DIR}/output/images/autoupdate* \
|
|
||||||
${FIRMWARE_DIR}/output/images/rootfs.squashfs.* \
|
|
||||||
${FIRMWARE_DIR}/output/images/uImage.* \
|
|
||||||
${FIRMWARE_DIR}/output/images/*.tar \
|
|
||||||
${COMPOSER_DIR}/archive/${PROJECT}_${TIMESTAMP}
|
|
||||||
|
|
||||||
echo_c 35 "\nAssembled firmware available in:"
|
|
||||||
tree -C "${COMPOSER_DIR}/archive/${PROJECT}_${TIMESTAMP}"
|
|
||||||
}
|
|
||||||
|
|
||||||
copy_to_tftp() {
|
|
||||||
echo_c 32 "\nCopy files to TFTP server"
|
|
||||||
scp -r ${FIRMWARE_DIR}/output/images/autoupdate* \
|
|
||||||
${FIRMWARE_DIR}/output/images/rootfs.squashfs.* \
|
|
||||||
${FIRMWARE_DIR}/output/images/uImage.* \
|
|
||||||
${TFTP_STORAGE}
|
|
||||||
}
|
|
||||||
|
|
||||||
select_project() {
|
|
||||||
AVAILABLE_PROJECTS=$(ls -1 ${COMPOSER_DIR}/projects)
|
|
||||||
cmd="whiptail --title \"Available projects\" --menu \"Please select a project from the list below:\" 25 78 16"
|
|
||||||
for p in $AVAILABLE_PROJECTS; do cmd="${cmd} \"$p\" \"\""; done
|
|
||||||
PROJECT=$(eval "${cmd} 3>&1 1>&2 2>&3")
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
echo_c 31 "Cancelled."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
echo_c 37 "COMPOSER - custom OpenIPC firmware builder"
|
|
||||||
echo_c 30 "https://openipc.org/"
|
|
||||||
echo_c 30 "Version: ${VERSION}"
|
|
||||||
|
|
||||||
while [ -z "${PROJECT}" ]; do select_project; done
|
|
||||||
|
|
||||||
echo_c 31 "\nStarting a project for ${PROJECT}"
|
|
||||||
tree -C ${COMPOSER_DIR}/projects/${PROJECT}
|
|
||||||
|
|
||||||
sleep 3
|
|
||||||
|
|
||||||
echo_c 33 "\nUpdating Composer"
|
|
||||||
git pull
|
|
||||||
|
|
||||||
# rm -rf openipc
|
|
||||||
if [ ! -d "$FIRMWARE_DIR" ]; then
|
|
||||||
echo_c 33 "\nDownloading Firmware"
|
|
||||||
git clone --depth=1 https://github.com/OpenIPC/firmware.git "$FIRMWARE_DIR"
|
|
||||||
cd "$FIRMWARE_DIR"
|
|
||||||
else
|
|
||||||
echo_c 33 "\nUpdating Firmware"
|
|
||||||
cd "$FIRMWARE_DIR"
|
|
||||||
# git reset HEAD --hard
|
|
||||||
# git pull --rebase
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo_c 33 "\nCopying extra packages"
|
|
||||||
cp -afv ${COMPOSER_DIR}/packages/* ${FIRMWARE_DIR}/general/package
|
|
||||||
|
|
||||||
echo_c 33 "\nCopying project files"
|
|
||||||
cp -afv ${COMPOSER_DIR}/projects/${PROJECT}/* ${FIRMWARE_DIR}
|
|
||||||
|
|
||||||
echo_c 33 "\nBuilding the project"
|
|
||||||
./building.sh ${PROJECT}
|
|
||||||
|
|
||||||
copy_to_archive
|
|
||||||
copy_to_tftp
|
|
||||||
echo_c 35 "\nDone"
|
|
||||||
cd "$COMPOSER_DIR"
|
|
Loading…
Reference in New Issue