dreamos82 / DreamOs

A small 32 bit Operating system written from scratch
GNU General Public License v3.0
62 stars 16 forks source link

Remove absolute paths from bochs configuration file #20

Closed inuyasha82 closed 5 months ago

inuyasha82 commented 7 years ago

i.e. vgaromimage romimage

ghost commented 7 years ago

It depends on the location of DreamOs folder, it can be anywhere so relative paths cannot be used in universal way. Maybe, do you mean using some script variable?

inuyasha82 commented 7 years ago

Emily it is obvious that depend on the location of Dreamos (and anyway it depens mainly on the location of bochs), my idea is to add in the readme a suggested path for bochs and dreamos and use a relative path to that default location, or maybe when you launch start.sh it will set an Environment variable with Bochs location, or look for it programmatically, I still have to decide.

ghost commented 7 years ago

We could redistribute vgaromimage and romimage bochs in dreamos folder?

inuyasha82 commented 7 years ago

I don't think is a good idea. I don't want to add binary files to the repository if not really necessary (and in this case this is not necessary)

ghost commented 7 years ago

Ok

ghost commented 7 years ago

If we want to use "locate" command, i made a small script that could be integrated in start.sh.

sh sample

#!/bin/sh
SEARCH=$(locate BIOS-bochs-latest)
OLD_IFS=$IFS     # save internal field separator
IFS='
'                # set it to newline
set -- $SEARCH   # make the result positional parameters
IFS=$OLD_IFS     # restore IFS
ROMIMAGE=$1
SEARCH=$(locate VGABIOS-lgpl-latest)
OLD_IFS=$IFS     # save internal field separator
IFS='
'                # set it to newline
set -- $SEARCH   # make the result positional parameters
IFS=$OLD_IFS     # restore IFS
VGAROMIMAGE=$1
echo $ROMIMAGE
echo $VGAROMIMAGE

Bash sample

#!/bin/bash

SEARCH=$(locate BIOS-bochs-latest)

IFS=$'\n' read -ra OUTPUT <<< "$SEARCH"
ROMIMAGE="${OUTPUT[0]}"

SEARCH=$(locate VGABIOS-lgpl-latest)

IFS=$'\n' read -ra OUTPUT <<< "$SEARCH"
VGAROMIMAGE="${OUTPUT[0]}"

echo $ROMIMAGE
echo $VGAROMIMAGE

ROMIMAGE and VGAROMIMAGE has got the first entry containing files we need. This solution needs 'updatedb' to be issued, to be sure that index db is updated.

ghost commented 7 years ago

I did the script to fully work making sed in .bochsrc file. Tell me what do you think about this script