initBDOS.sh 870 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. # Script to initialize BDOS (as in an intitial setup) by uploading all the programs in userBDOS to the /bin directory
  3. MAINPATH=$(pwd)
  4. echo $MAINPATH
  5. # Create /bin directory
  6. echo "cd /" | python3 "$MAINPATH/../Programmer/sendCommand.py"
  7. sh uploadToBDOS.sh userBDOS/mkdir.c mkdir
  8. echo "mkdir /bin" | python3 "$MAINPATH/../Programmer/sendCommand.py"
  9. echo "cd /bin" | python3 "$MAINPATH/../Programmer/sendCommand.py"
  10. #sleep 0.5
  11. # Upload all the programs in a very hardcoded way given the directory structure of the project
  12. cd userBDOS
  13. for j in $(find . -maxdepth 1 -type f -print)
  14. do
  15. cd $MAINPATH
  16. FNAME=$(basename $j)
  17. # Remove extension from FNAME
  18. FNAME="${FNAME%.*}"
  19. # Remove leading ./
  20. j="${j#./}"
  21. bash uploadToBDOS.sh userBDOS/$j $FNAME
  22. #sleep 0.5
  23. done
  24. echo "rm /mkdir" | python3 "$MAINPATH/../Programmer/sendCommand.py"