Last active
June 28, 2022 13:42
-
-
Save Andrej123456789/ffe188950b2ab954220932dfa62876f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "-----------------------------------------------------------------------------" | |
echo " -------------------- RUNIX INSTALLER --------------------" | |
echo "-----------------------------------------------------------------------------" | |
echo "1. Make sure you have free unmounted hard drive with partition of minimum size 1GB and ext4 filesystem" | |
echo "2. ./install.sh [PARTITON] [KERNEL VERSION]" | |
echo " " | |
if [[ "$1" != "" ]]; then | |
PARTITON="$1" | |
else | |
PARTITON=. | |
fi | |
if [[ "$2" != "" ]]; then | |
KERNEL="$2" | |
else | |
KERNEL=. | |
fi | |
echo "Selected partion is: '" + $PARTITON | |
echo "Selected kernel version is: '" + $KERNEL | |
echo "Do you want to continue (use this program on your risk) (y/n)? " | |
old_stty_cfg=$(stty -g) | |
stty raw -echo ; answer=$(head -c 1) ; stty $old_stty_cfg # Careful playing with stty | |
if echo "$answer" | grep -iq "^y" ;then | |
echo " " | |
echo "Starting..." | |
else | |
echo " " | |
echo "Exiting..." | |
exit | |
fi | |
cd /mnt | |
mkdir Runix | |
mount $PARTITON Runix | |
cd Runix | |
rm -rf lost+found/ | |
mkdir -pv ./{bin,sbin,etc,lib,lib64,var,dev,proc,sys,run,tmp} | |
mknod -m 600 ./dev/console c 5 1 | |
mknod -m 606 ./dev/null c 1 3 | |
mkdir boot | |
cd boot | |
cp /boot/vmlinuz-$KERNEL . | |
cp /boot/initrd.img-$KERNEL . | |
grub-install $PARTITON --skip-fs-probe --boot-directory=/mnt/Runix/boot | |
cd grub | |
curl -o grub.cfg https://gist.githubusercontent.com/Andrej123456789/8aa6832e85f5eaf16d4f3c1a55def327/raw/d6ff4b4abe65e088a52642c99a5b6db6e55b15d3/grub.cfg | |
echo "PLEASE UPDATE grub.cfg TO YOUR PARTITON AND KERNEL VERSION!" | |
cd ../../ | |
mkdir src | |
cd src | |
echo "Installation is finished!" | |
echo "Do you want to download code (y/n)? " | |
old_stty_cfg=$(stty -g) | |
stty raw -echo ; answer=$(head -c 1) ; stty $old_stty_cfg # Careful playing with stty | |
if echo "$answer" | grep -iq "^y" ;then | |
echo " " | |
echo "Currently this program just download first part!" | |
curl -o init.c https://raw.githubusercontent.com/rockytriton/LLD/main/linux_os/part1/src/init.c | |
curl -o start.S https://raw.githubusercontent.com/rockytriton/LLD/main/linux_os/part1/src/start.S | |
echo "Finished!" | |
exit | |
else | |
echo " " | |
echo "Exiting..." | |
exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment