aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Van Iseghem <[email protected]>2023-05-25 13:08:45 +0200
committerThomas Van Iseghem <[email protected]>2023-05-25 13:08:45 +0200
commit5e8c6fcd000587acd3bca4fb4c35b48a8544de47 (patch)
treef731e6e9baa1bc8e93653eaab80a72c7be0c8627
parent2086a71d83ca2ef899e32ba4e02f0603c95cfcb9 (diff)
downloadOpenCortex-5e8c6fcd000587acd3bca4fb4c35b48a8544de47.tar.gz
OpenCortex-5e8c6fcd000587acd3bca4fb4c35b48a8544de47.zip
Fixed chroot uname and added error handling for mounting update file
-rw-r--r--CorOS-dev-environment/init_system.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/CorOS-dev-environment/init_system.sh b/CorOS-dev-environment/init_system.sh
index d43ab6c..b575329 100644
--- a/CorOS-dev-environment/init_system.sh
+++ b/CorOS-dev-environment/init_system.sh
@@ -1,6 +1,7 @@
#!/bin/bash
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
+RED='\033[0;31m'
NC='\033[0m' # No Color
# echo the ascii art banner
@@ -19,6 +20,16 @@ echo ""
echo -e "${YELLOW}[!]${NC} Mounting the CorOS update, this can take a couple of seconds..."
# Decompress archive and mount rootfs.ext3
tar -xvf /qc-fs/$UPDATE_FILE -C /qc-fs-uncompressed
+if [ $? -ne 0 ]
+then
+ # Check if the file exists
+ if [ ! -f /qc-fs/$UPDATE_FILE ]; then
+ echo -e "${RED}Error: $UPDATE_FILE does not exist${NC}"
+ else
+ echo -e "${RED}Error: Failed to extract $UPDATE_FILE${NC}"
+ fi
+ exit 1
+fi
echo "Mounting rootfs.ext3"
mount -t ext4 /qc-fs-uncompressed/rootfs.ext3 $QEMU_LD_PREFIX
@@ -56,7 +67,6 @@ if [[ $REPLY =~ ^[Yy]$ ]]
then
echo ""
echo "[->] Chrooting into $QEMU_LD_PREFIX"
- echo $(uname -a)
+ chroot $QEMU_LD_PREFIX sh -c "uname -a" && chroot $QEMU_LD_PREFIX/
echo ""
- chroot $QEMU_LD_PREFIX
fi