Comments (7)
The relative path becomes a problem if you are using docker build environment. Or multiple CustomPiOS source trees.
I am not sure how to solve this without placing custompios in the execution PATH variable. So this was the compromise at the time.
What exactly are you proposing with relative paths? Relative to the working directory or the distro you are building?
from custompios.
i think that relative paths to the distro is what I mean.
e.g.
$ .
├── LICENSE
├── README.md
├── mydistro
│ └── src
│ ├── build_dist
│ ├── config
│ └── custompios_path
└── src
├── build
├── build_custom_os
├── build_docker
├── common.sh
├── config
├── config_sanity
├── custompios
├── make_custom_pi_os
└── update-custompios-paths
$ cat mydistro/src/custompios_path
../../src
this obviously assumes that it actually makes sense to use a relative path, because the mydistro
directory and the CustomPiOS/src
folder are guaranteed to have a fixed relative path (e.g. because both are tracked in the same git repository). this is my current mode of operation (but I'm sure others do it differently).
it probably makes sense to have src/update-custompios-paths
generate absolute paths, but allow relative paths.
right now it fails with:
python3: can't open file '<<CUSTOMPIOS_SRCDIR>>/mydistro/src/workspace/mount/../../src/execution_order.py': [Errno 2] No such file or directory
from custompios.
sidenote: my current workaround to this problem is to exclude the mydist/src/custompios_path
from my repository, and instead have a wrapper-script that first creates this file (with the absolute path) and then call mydistro's build_dist
.
so the priority of this issue is pretty low for me.
from custompios.
i guess this might work:
diff --git a/src/dist_generators/dist_example/src/build_dist b/src/dist_generators/dist_example/src/build_dist
index e3d3cb8..14799a7 100755
--- a/src/dist_generators/dist_example/src/build_dist
+++ b/src/dist_generators/dist_example/src/build_dist
@@ -5,4 +5,6 @@ export DIST_PATH=${DIR}
export CUSTOM_PI_OS_PATH=$(<${DIR}/custompios_path)
export PATH=$PATH:$CUSTOM_PI_OS_PATH
+CUSTOM_PI_OS_PATH="$( cd "$(DIR}" && cd "${CUSTOM_PI_OS_PATH}" && pwd )"
+
${CUSTOM_PI_OS_PATH}/build_custom_os $@
afaict, the custompios_path
file is only read once (in the distro's build_dist
script) so it could be expanded to an absolute path right there.
this still doesn't handle the expansion in Vagrantfile
though (I'm afraid my ruby-knowledge is nil)
from custompios.
i guess that's the change required for the Vagrantfile:
diff --git a/src/dist_generators/dist_example/src/vagrant/Vagrantfile b/src/dist_generators/dist_example/src/vagrant/Vagrantfile
index 4484441..f6bfa37 100644
--- a/src/dist_generators/dist_example/src/vagrant/Vagrantfile
+++ b/src/dist_generators/dist_example/src/vagrant/Vagrantfile
@@ -2,7 +2,7 @@ vagrant_root = File.dirname(__FILE__)
Vagrant.configure("2") do |o|
o.vm.box = "debian/buster64"
o.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
- o.vm.synced_folder File.read("../custompios_path").gsub("\n",""), "/CustomPiOS", create:true, type: "nfs"
+ o.vm.synced_folder File.expand_path(File.read("../custompios_path").gsub("\n", ""), ".."), "/CustomPiOS", create:true, type: "nfs"
o.vm.synced_folder "../", "/distro", create:true, type: "nfs"
o.vm.network :private_network, ip: "192.168.55.55"
o.vm.provision :shell, :path => "setup.sh", args: ENV['SHELL_ARGS']
note that i haven't actually tested this with Vagrant (just with a small, standalone ruby script)
from custompios.
Its part of .gitignore on my distros:
eg:
https://github.com/guysoft/OctoPi/blob/devel/.gitignore#L2
I initially didn't add git files in to the template folder of a new distro. But since 2013 when it started git has become the only version control out there. Though there are a few that use mercurial (though I rarely see .hgignore). So perhaps it might make sense to add now a default .gitignore.
ATM the vagrant is falling out of support no one is actually using it. And I have no time to test it.
from custompios.
I initially didn't add git files in to the template folder of a new distro.
oops: with b10ed77 i have introduced a default .gitignore
file (and continued to work on that with 25bff8b).
so probably, you could just keep it and add more files?
and what do you think of #206 (comment)?
one potential drawback i see is, that if the path in custompios_path
does not exist (regardless of absolute or relative), the CUSTOM_PI_OS_PATH
will then hold the same value as DIR
.
this might give confusing error messages.
using realpath
instead of the cd ... && pwd
magic would fix this, but i guess it is not very portable (e.g. wouldn't run on macOS)
from custompios.
Related Issues (20)
- RPM based distro support HOT 3
- BTRFS needs to resize correctly
- Bug /dev/loop0 Partition don't follow the config to resize HOT 5
- Add secondary root partition HOT 1
- qemu_boot requires xz-compressed images to live in /tmp HOT 6
- use POSIX parameter expansion for assigning default values HOT 2
- dangling files after build eat diskspace. HOT 1
- allow out-of-tree builds HOT 2
- allow one to alter the user(name) without setting a default password HOT 3
- Build within container abruptly stops on current `devel` image HOT 3
- permissions of the generated image file HOT 3
- Script ./src/make_custom_pi_os returns unexpected error HOT 12
- CustomPiOS v2 - support for remote modules and meta modules and more HOT 14
- docker build: failed to set up loop device: No such file or directory HOT 1
- Decided to improve the logo, and incorporate the new FullPageOS design into it HOT 4
- Skip "user rename" on first boot and $BASE_USER HOT 1
- Moving scripts from /home/pi/scripts to /opt/custompios/scripts HOT 3
- wpa_supplicant autoconfigure removed in bookworm but not replaced with other mechanism, breaking network module
- The file `/boot/config.txt` has moved to `/boot/firmware/config.txt` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from custompios.