Index: catalyst-2.0/modules/generic_stage_target.py =================================================================== --- catalyst-2.0.orig/modules/generic_stage_target.py +++ catalyst-2.0/modules/generic_stage_target.py @@ -163,14 +163,16 @@ class generic_stage_target(generic_targe # setup our mount points if self.settings.has_key("SNAPCACHE"): - self.mounts=[ "/proc","/dev","/dev/pts","/usr/portage","/usr/portage/distfiles" ] + self.mounts=[ "/proc","/dev","/usr/portage","/usr/portage/distfiles" ] self.mountmap={"/proc":"/proc", "/dev":"/dev", "/dev/pts":"/dev/pts",\ "/usr/portage":self.settings["snapshot_cache_path"]+"/portage",\ "/usr/portage/distfiles":self.settings["distdir"]} else: - self.mounts=[ "/proc","/dev","/dev/pts","/usr/portage/distfiles" ] + self.mounts=[ "/proc","/dev","/usr/portage/distfiles" ] self.mountmap={"/proc":"/proc", "/dev":"/dev", "/dev/pts":"/dev/pts",\ "/usr/portage/distfiles":self.settings["distdir"]} + if os.uname()[0] == "Linux": + self.mounts.append("/dev/pts") self.set_mounts() @@ -768,7 +770,13 @@ class generic_stage_target(generic_targe src=self.mountmap[x] if self.settings.has_key("SNAPCACHE") and x == "/usr/portage": self.snapshot_lock_object.read_lock() - retval=os.system("mount --bind "+src+" "+self.settings["chroot_path"]+x) + if os.uname()[0] == "FreeBSD": + if src == "/dev": + retval=os.system("mount -t devfs none "+self.settings["chroot_path"]+x) + else: + retval=os.system("mount_nullfs "+src+" "+self.settings["chroot_path"]+x) + else: + retval=os.system("mount --bind "+src+" "+self.settings["chroot_path"]+x) if retval!=0: self.unbind() raise CatalystError,"Couldn't bind mount "+src @@ -788,7 +796,7 @@ class generic_stage_target(generic_targe # it's not mounted, continue continue - retval=os.system("umount "+mypath+x) + retval=os.system("umount "+os.path.join(mypath,x.lstrip(os.path.sep))) if retval!=0: warn("First attempt to unmount: "+mypath+x+" failed.") @@ -1278,6 +1286,8 @@ class generic_stage_target(generic_targe # the proper perms and ownership mystat=os.stat(myemp) #cmd("rm -rf "+myemp, "Could not remove existing file: "+myemp,env=self.env) + if os.uname()[0] == "FreeBSD": # There's no easy way to change flags recursively in python + os.system("chflags -R noschg "+myemp) shutil.rmtree(myemp) os.makedirs(myemp,0755) os.chown(myemp,mystat[ST_UID],mystat[ST_GID]) Index: catalyst-2.0/targets/stage1/stage1-controller.sh =================================================================== --- catalyst-2.0.orig/targets/stage1/stage1-controller.sh +++ catalyst-2.0/targets/stage1/stage1-controller.sh @@ -57,10 +57,10 @@ case $1 in # Clean out man, info and doc files rm -rf usr/share/{man,doc,info}/* # Zap all .pyc and .pyo files - find -iname "*.py[co]" -exec rm -f {} \; + find . -iname "*.py[co]" -exec rm -f {} \; # Cleanup all .a files except libgcc.a, *_nonshared.a and # /usr/lib/portage/bin/*.a - find -type f -iname "*.a" | grep -v 'libgcc.a' | grep -v 'nonshared.a' \ + find . -type f -iname "*.a" | grep -v 'libgcc.a' | grep -v 'nonshared.a' \ | grep -v '/usr/lib/portage/bin/' | grep -v 'libgcc_eh.a' | xargs \ rm -f ;; Index: catalyst-2.0/targets/support/chroot-functions.sh =================================================================== --- catalyst-2.0.orig/targets/support/chroot-functions.sh +++ catalyst-2.0/targets/support/chroot-functions.sh @@ -215,7 +215,11 @@ function copy_symlink() { [ ! -e ${clst_root_path}/${1} ] && \ cp -vfdp ${1} ${clst_root_path}/${1} - TARGET=`readlink -f ${1}` + if [[ -n $(type -p realpath) ]]; then + TARGET=`realpath ${1}` + else + TARGET=`readlink -f ${1}` + fi if [ -h ${TARGET} ] then copy_symlink ${TARGET} ${STACK}