aboutsummaryrefslogtreecommitdiff
path: root/run
diff options
context:
space:
mode:
authorMarvin Borner2020-04-02 13:05:56 +0200
committerMarvin Borner2020-04-02 13:05:56 +0200
commit0f47372d4e8395cdbd9158fb45dd3a6d58e9a52e (patch)
tree81ecdfff7a7adf49699f07235d5f78ca7207c8bf /run
parentf7d4c8891e5ef64d13567845b2bc02f31152c323 (diff)
Fixed error exiting in whole script
Diffstat (limited to 'run')
-rwxr-xr-xrun36
1 files changed, 18 insertions, 18 deletions
diff --git a/run b/run
index 736e3ec..1664cbb 100755
--- a/run
+++ b/run
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
-cd "$(dirname "$0")" || exit
+cd "$(dirname "$0")" || exit 1
mode="${1}"
network="rtl8139"
@@ -16,9 +16,9 @@ qemu_with_flags() {
compile_with_flags() {
if [ "${mode}" = "image" ] || [ "${mode}" = "image_debug" ]; then
- GCC_COLORS=1 ccache i686-elf-gcc -std=gnu99 -ffreestanding -nostdlib -Wall -Wextra -Wno-unused-parameter -D INSTALL_MELVIX "$@" || exit
+ GCC_COLORS=1 ccache i686-elf-gcc -std=gnu99 -ffreestanding -nostdlib -Wall -Wextra -Wno-unused-parameter -D INSTALL_MELVIX "$@" || exit 1
else
- GCC_COLORS=1 ccache i686-elf-gcc -std=gnu99 -ffreestanding -nostdlib -Wall -Wextra -Wno-unused-parameter "$@" || exit
+ GCC_COLORS=1 ccache i686-elf-gcc -std=gnu99 -ffreestanding -nostdlib -Wall -Wextra -Wno-unused-parameter "$@" || exit 1
fi
}
@@ -27,11 +27,11 @@ make_cross() {
if [ ! -d "./cross/" ]; then
# Create directory
mkdir -p cross
- cd cross || exit
+ cd cross || exit 1
DIR=$(pwd)
# Get sources
- mkdir "${DIR}/src" && cd "${DIR}/src" || exit
+ mkdir "${DIR}/src" && cd "${DIR}/src" || exit 1
echo "Downloading..."
curl -sSL "https://ftp.gnu.org/gnu/binutils/binutils-2.32.tar.xz" | tar xJ
curl -sSL "https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz" | tar xJ
@@ -43,23 +43,23 @@ make_cross() {
export PATH="$PREFIX/bin:$PATH"
# Compile binutils
- mkdir "${DIR}/src/build-binutils" && cd "${DIR}/src/build-binutils" || exit
+ mkdir "${DIR}/src/build-binutils" && cd "${DIR}/src/build-binutils" || exit 1
../binutils-2.32/configure --target="$TARGET" --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
make
make install
# Compile GCC
- mkdir "${DIR}/src/build-gcc" && cd "${DIR}/src/build-gcc" || exit
+ mkdir "${DIR}/src/build-gcc" && cd "${DIR}/src/build-gcc" || exit 1
../gcc-9.2.0/configure --target="$TARGET" --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc
- cd "${DIR}/.." || exit
+ cd "${DIR}/.." || exit 1
else
# Should be sourced to take effect
- cd cross || exit
+ cd cross || exit 1
DIR=$(pwd)
export PREFIX="${DIR}/opt"
export TARGET=i686-elf
@@ -78,7 +78,7 @@ make_build() {
stripped=$(echo "${line}" | sed -r 's/\//_/g')
stripped=${stripped#??????}
stripped=${stripped%%???}o
- nasm -f elf ./"${line}" -o ./build/kernel/asm_"${stripped}" || exit
+ nasm -f elf ./"${line}" -o ./build/kernel/asm_"${stripped}" || exit 1
done <./build/tmp
rm ./build/tmp
@@ -116,11 +116,11 @@ make_build() {
# Create ISO
mkdir -p ./iso/boot/
mv ./build/melvix.bin ./iso/boot/kernel.bin
- nasm ./src/bootloader/cd.asm -f bin -o ./iso/boot/cd.bin || exit
- nasm ./src/bootloader/hdd1.asm -f bin -o ./iso/boot/hdd1.bin || exit
- nasm ./src/bootloader/hdd2.asm -f bin -o ./iso/boot/hdd2.bin || exit
- cp ./build/user.bin ./iso/user.bin || exit
- cp ./build/font.bin ./iso/font.bin || exit
+ nasm ./src/bootloader/cd.asm -f bin -o ./iso/boot/cd.bin || exit 1
+ nasm ./src/bootloader/hdd1.asm -f bin -o ./iso/boot/hdd1.bin || exit 1
+ nasm ./src/bootloader/hdd2.asm -f bin -o ./iso/boot/hdd2.bin || exit 1
+ cp ./build/user.bin ./iso/user.bin || exit 1
+ cp ./build/font.bin ./iso/font.bin || exit 1
genisoimage -quiet -input-charset utf-8 -no-emul-boot -b boot/cd.bin -o ./build/melvix.iso ./iso
head -c 10485760 /dev/zero >./build/hdd10M.img
@@ -146,7 +146,7 @@ make_image() {
end=$(date +%s.%N)
cat install.log
printf "[LOG END]\n\n"
- tail install.log | grep -q "Installation successful!" && echo Booted and installed within "$(echo "$end - $start" | bc -l)" seconds || echo Installation failed! && exit
+ tail install.log | grep -q "Installation successful!" && echo Booted and installed within "$(echo "$end - $start" | bc -l)" seconds || echo Installation failed! && exit 1
rm install.log
}
@@ -154,10 +154,10 @@ make_sync() {
rm tags compile_commands.json
ctags -R --exclude=.git --exclude=build --exclude=iso --exclude=cross .
mkdir -p cmake
- cd cmake || exit
+ cd cmake || exit 1
cmake .. >/dev/null
mv compile_commands.json ..
- cd .. || exit
+ cd .. || exit 1
}
make_tidy() {