Skip to content
This repository has been archived by the owner on Feb 10, 2020. It is now read-only.

Use bindfs for /dev #11

Merged
merged 1 commit into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion md2pdf_webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def main():
static_content_error = True
logging.error("Static content '%s' was not found in '%s', this might cause Pandoc to fail", content, static_path)
if static_content_error and running_as_snap:
logging.error("Note that md2md2pdf_webserver is running as a Snap package - it might be confined and unable to access absolute paths")
logging.error("Note that md2pdf_webserver is running as a Snap package - it might be confined and unable to access absolute paths")

## Remove old temporary files
logging.info("Deleting files in '" + def_tempdir + "'")
Expand All @@ -219,6 +219,11 @@ def main():
logging.warning("Unable to delete and re-create temporary directory")
raise

## Start the bind mount for /dev
arg = 'bindfs ' + '/dev/ ' + os.path.join(chroot_path, 'dev-real')
p = subprocess.Popen(arg, shell=True)
p.wait()

## Start the CherryPy server
def_listen = args.listen
def_port = args.port
Expand Down
13 changes: 6 additions & 7 deletions setup-chroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ echo "Creating basic folder structure"
mkdir bin
mkdir usr
mkdir dev
mkdir dev-real
mkdir etc
mkdir lib
mkdir tmp
Expand Down Expand Up @@ -116,14 +117,12 @@ then
cp -a ${SNAP}/bin/pandoc-crossref bin/
fi

echo "Mounting /dev inside chroot"
bindfs /dev/ dev-real/

echo "Setting up a small amount of entropy into /dev/random"
echo "(this will be faster if you use the keyboard and mouse!)"

# Hide the output from dd, it's not really helpful in this case
dd if=/dev/random of=dev/random bs=1 count=128 1> /dev/null
dd if=/dev/urandom of=dev/urandom bs=1 count=128 1> /dev/null

echo "Linking /dev/random and /dev/urandom inside chroot"
ln -s dev-real/random dev/random
ln -s dev-real/urandom dev/urandom

echo "Mounting TeX Live ISO installer"

Expand Down