From 2c57afa1e3d61cb4a0801c0eb2c1646f3ad7be60 Mon Sep 17 00:00:00 2001 From: Thomas Van Iseghem Date: Tue, 23 May 2023 19:28:15 +0200 Subject: Improved user interactable scripts --- CorOS-dev-environment/init_system.sh | 39 +++++++++++++++++++++--------- CorOS-dev-environment/update-builder.sh | 43 ++++++++++++++++++++++++--------- 2 files changed, 58 insertions(+), 24 deletions(-) (limited to 'CorOS-dev-environment') diff --git a/CorOS-dev-environment/init_system.sh b/CorOS-dev-environment/init_system.sh index 8b931f9..5009cfa 100644 --- a/CorOS-dev-environment/init_system.sh +++ b/CorOS-dev-environment/init_system.sh @@ -1,5 +1,22 @@ #!/bin/bash +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color +# echo the ascii art banner +echo -e "${YELLOW}" +echo " ____ ______ __ " +echo " / __ \____ ___ ____ / ____/___ _____/ /____ _ __ " +echo " / / / / __ \/ _ \/ __ \/ / / __ \/ ___/ __/ _ \| |/_/ " +echo " / /_/ / /_/ / __/ / / / /___/ /_/ / / / /_/ __/> < " +echo " \____/ .___/\___/_/ /_/\____/\____/_/ \__/\___/_/|_| " +echo " /_/ CorOS emulation environment " +echo -e "${NC}" + +echo -e "${BLUE}========= Initializing CorOS emulation environment =========${NC}" + +echo "" +echo -e "${YELLOW}[!]${NC} Mounting the QC-filesystem, this can take a couple of seconds..." # Decompress archive and mount rootfs.ext3 gunzip -d -k /qc-fs/$UPDATE_FILE # Run tar command on the decompressed file to extract the rootfs.ext3 file @@ -9,33 +26,31 @@ rm /qc-fs/${UPDATE_FILE::-3} echo "Mounting rootfs.ext3" mount -t ext4 /qc-fs-uncompressed/rootfs.ext3 $QEMU_LD_PREFIX -echo "Mounting rootfs.ext3 finished" +echo -e "${YELLOW}Mounting rootfs.ext3 finished!${NC}" +echo "" # Promt the user to install custom QT # if the user types "y" or "Y" then install custom QT -echo "Do you want to install the custom compiled QT? (y/n)" -echo "" -read -n 1 -r -echo "" +read -p "Do you want to install the custom compiled QT? (y/n) " -r if [[ $REPLY =~ ^[Yy]$ ]] then - echo "Installing QT" + echo -e "${YELLOW}[!]${NC} Installing QT" cd /qt_src && ./install_qt_compiled.sh - echo "Installing QT finished" + echo -e "${YELLOW}Installing QT finished${NC}" fi +echo "" # Prompt user to chroot into the $QEMU_LD_PREFIX directory # if the user types "y" or "Y" then chroot into the $QEMU_LD_PREFIX directory # otherwise exit the script -echo "Do you want to chroot into the created QC-filesystem? (y/n)" -echo "" -read -n 1 -r -echo "" +read -p "Do you want to chroot into the created QC-filesystem? (y/n) " -r if [[ $REPLY =~ ^[Yy]$ ]] then echo "" - echo "Chrooting into $QEMU_LD_PREFIX" + echo "[->] Chrooting into $QEMU_LD_PREFIX" + echo $(uname -a) + echo "" chroot $QEMU_LD_PREFIX fi diff --git a/CorOS-dev-environment/update-builder.sh b/CorOS-dev-environment/update-builder.sh index ab4e8b9..da6ea99 100644 --- a/CorOS-dev-environment/update-builder.sh +++ b/CorOS-dev-environment/update-builder.sh @@ -1,23 +1,42 @@ -#!/bin/sh +#!/bin/bash # This script can be used to apply OpenCortex patches to a mounted QC file system # And create a new update file from it # This script is intended to be run from the QC-dev-environment directory BLUE='\033[0;34m' +YELLOW='\033[1;33m' NC='\033[0m' # No Color -echo "${BLUE}========= OpenCortex Update Builder =========${NC}" +# echo the ascii art banner +echo -e "${YELLOW}" +echo -e " ____ ______ __ " +echo -e " / __ \____ ___ ____ / ____/___ _____/ /____ _ __ " +echo -e " / / / / __ \/ _ \/ __ \/ / / __ \/ ___/ __/ _ \| |/_/ " +echo -e " / /_/ / /_/ / __/ / / / /___/ /_/ / / / /_/ __/> < " +echo -e " \____/ .___/\___/_/ /_/\____/\____/_/ \__/\___/_/|_| " +echo -e " /_/ CorOS update builder " +echo -e "${NC}" -cd /qc-fs-uncompressed +echo "This tool can be used to create a new update file based on the mounted CorOS file system" +echo -e "${BLUE}========= OpenCortex Update Builder =========${NC}" + +read -p "Do you want create a new update package from the current mounted CorOS? (y/n) " -r + +if [[ $REPLY =~ ^[Yy]$ ]] +then + cd /qc-fs-uncompressed + + echo "" + echo -e "${YELLOW}[!]${NC} Building update file..." + echo "" + tar cvf update-opencortex.bin rootfs.ext3 uImage zpu.dtb + echo "" + echo -e "${YELLOW}[!]${NC} Creating archive. This can take some seconds, please wait..." + gzip -k update-opencortex.bin + cp update-opencortex.bin.gz /qc-fs/update-opencortex.bin.gz + echo "" + echo -e "${BLUE}[+]${NC} Update file created: update-opencortex.bin.gz" +fi echo "" -echo "${BLUE}[+]${NC} Building update file..." -echo "" -tar cvf update-opencortex.bin rootfs.ext3 uImage zpu.dtb -echo "" -echo "This can take some seconds, please wait..." -gzip -k update-opencortex.bin -cp update-opencortex.bin.gz /qc-fs/update-opencortex.bin.gz -echo "" -echo "${BLUE}[+]${NC} Update file created: update-opencortex.bin.gz" \ No newline at end of file -- cgit v1.2.3