View previous topic :: View next topic |
Author |
Message |
crocket Guru
Joined: 29 Apr 2017 Posts: 558
|
Posted: Sat Oct 20, 2018 11:59 pm Post subject: [SOLVED] How to package DOS programs with dosbox? |
|
|
DOS programs can be run with dosbox. However, many DOS programs do not save config in a separate config directory. They save config in the same directory as executables are in.
I thought about creating a dosbox launcher that separates program data from program through overlayfs. But, mounting and unmounting overlayfs can be fragile.
How would you approach packaging DOS programs?
Last edited by crocket on Sun Oct 21, 2018 10:37 am; edited 2 times in total |
|
Back to top |
|
|
fpemud Guru
Joined: 15 Feb 2012 Posts: 349
|
|
Back to top |
|
|
crocket Guru
Joined: 29 Apr 2017 Posts: 558
|
Posted: Sun Oct 21, 2018 2:33 am Post subject: |
|
|
I do not understand how they work. I don't have access to files that SRC_URI refers to. Reverse-engineering your ebuild is difficult.
Can you explain how you made it work? Can you explain in english? |
|
Back to top |
|
|
fpemud Guru
Joined: 15 Feb 2012 Posts: 349
|
Posted: Sun Oct 21, 2018 5:41 am Post subject: |
|
|
The game is installed in a directory in /opt, and the game is started by a dedicated shell script.
Run the game for the first time:
1. Create a directory ~/.cache/XXX, symlink all the files in /opt/XXX into this directory.
2. Create a directory ~/.config/XXX for game config files and data files.
3. Start the game and wait for it to complete.
4. Generally, the game should create config files and data files in ~/.cache/XXX. Copy these files into ~/.config/XXX
Run the game normally:
1. Copy files in ~/.config/XXX to /.cache/XXX
2. Start the game and wait for it to complete.
3. Copy config files and data files in ~/.cache/XXX. into ~/.config/XXX
Data in windows registry can be treated in a similar way: import ~/.config/XXX into wine registry before game starts and do a reverse operation after game stops.
This solution can be applied to arbitrary dosbox/wine programs.
Quote: | I don't have access to files that SRC_URI refers to. |
Git repo updated. Scripts and auxiliary config files have been moved from private ftp to ebuild directory.
By the way, what DOS program you are about to run on gentoo? |
|
Back to top |
|
|
crocket Guru
Joined: 29 Apr 2017 Posts: 558
|
Posted: Sun Oct 21, 2018 7:33 am Post subject: |
|
|
fpemud wrote: | The game is installed in a directory in /opt, and the game is started by a dedicated shell script.
Run the game for the first time:
1. Create a directory ~/.cache/XXX, symlink all the files in /opt/XXX into this directory.
2. Create a directory ~/.config/XXX for game config files and data files.
3. Start the game and wait for it to complete.
4. Generally, the game should create config files and data files in ~/.cache/XXX. Copy these files into ~/.config/XXX
Run the game normally:
1. Copy files in ~/.config/XXX to /.cache/XXX
2. Start the game and wait for it to complete.
3. Copy config files and data files in ~/.cache/XXX. into ~/.config/XXX
Data in windows registry can be treated in a similar way: import ~/.config/XXX into wine registry before game starts and do a reverse operation after game stops.
This solution can be applied to arbitrary dosbox/wine programs.
Quote: | I don't have access to files that SRC_URI refers to. |
Git repo updated. Scripts and auxiliary config files have been moved from private ftp to ebuild directory.
By the way, what DOS program you are about to run on gentoo? |
I think I can make it simpler by mounting an overlayfs file system, but overlayfs requires root permission, and it doesn't work on ZFS.
A normal user union mount is going to be really sweet.
I want to run DOS typing tutors through a dosbox launcher that helps package DOS programs for linux distrubitions. Those tutors save configurations and program data in the same directories as executables are in or in the subdirectories of these directories.
I'm thinking about utilizing https://packages.gentoo.org/packages/sys-fs/unionfs-fuse |
|
Back to top |
|
|
crocket Guru
Joined: 29 Apr 2017 Posts: 558
|
Posted: Sun Oct 21, 2018 9:43 am Post subject: |
|
|
I just succeeded in separating program data from program by using unionfs-fuse.
This is better than copying symlinks and regular files back and forth.
The procedure is
1. unionfs -o cow program_data_dir=RW:program_dir=RO merged_directory
2. dosbox -exit -other_options merged_directory/program.exe
3. fusermount -u merged_directory.
You can execute those commands as a normal user. This doesn't require root permission. With this, I can package DOS programs for gentoo. |
|
Back to top |
|
|
fpemud Guru
Joined: 15 Feb 2012 Posts: 349
|
Posted: Sun Oct 21, 2018 11:14 am Post subject: |
|
|
Great work!
What I know is there's no unified way for all the dos/win32 program.
There are many programs that have ad-hoc behavior.
Your way is really a better solution, at least it can eliminate the usage of ~/.cache directory.
I think I can use it to simplify some of my ebuilds. |
|
Back to top |
|
|
crocket Guru
Joined: 29 Apr 2017 Posts: 558
|
Posted: Mon Oct 22, 2018 12:24 am Post subject: |
|
|
fpemud wrote: | Great work!
What I know is there's no unified way for all the dos/win32 program.
There are many programs that have ad-hoc behavior.
Your way is really a better solution, at least it can eliminate the usage of ~/.cache directory.
I think I can use it to simplify some of my ebuilds. |
You might want to combine fuse-zip with unionfs-fuse
Code: | #!/bin/sh
# Arguments
zipfile=/usr/share/DOSprogram/program.zip
dosboxconf=/usr/share/DOSprogram/dosbox.conf
progname=DOSprogram
exe=program.exe
# Variables
lower=/tmp/dosbox-launcher/$progname/lower
merged=/tmp/dosbox-launcher/$progname/merged
upper=~/.dosbox-launcher/$progname
fuse-zip -r $zipfile $lower
unionfs -o cow,hide_meta_files $upper=RW:$lower=RO $merged
dosbox -exit -userconf -conf $dosboxconf -conf ~/.config/dosbox-launcher/dosbox-$progname.conf $merged/$exe
fusermount -u $merged
fusermount -u $lower |
|
|
Back to top |
|
|
|