• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Pseudo file example
2
3# Mksquashfs supports pseudo files, these allow fake files, directories,
4# character and block devices to be specified and added to the Squashfs
5# filesystem being built, rather than requiring them to be present in the
6# source directories.
7#
8# This, for example, allows device nodes to be added to the filesystem without
9# requiring root access.
10
11# Mksquashfs 4.1 adds support for "dynamic pseudo files" and a modify operation.
12# Dynamic pseudo files allow files to be dynamically created when Mksquashfs
13# is run, their contents being the result of running a command or piece of
14# shell script.  The modifiy operation allows the mode/uid/gid of an existing
15# file in the source filesystem to be modified.
16
17# Two Mksquashfs options are supported, -p allows one pseudo file to be
18# specified #on the command line, and -pf allows a pseudo file to be specified
19# containing a list of pseduo definitions, one per line.
20
21# Pseudo file examples
22# Run mkquashfs . /tmp/img -pf pseudo-file.examples
23# to see their effect
24
25# Creating dynamic file examples
26
27# Create a file "dmesg" containing the output from dmesg.
28dmesg f 444 root root dmesg
29
30
31# Create a file RELEASE containing the release name, date, build host, and
32# an incrementing version number.  The incrementing version is a side-effect
33# of executing the shell script, and ensures every time Mksquashfs is run a
34# new version number is used without requiring any other shell scripting.
35RELEASE f 444 root root \
36		if [ ! -e /tmp/ver ]; then \
37			echo 0 > /tmp/ver; \
38		fi; \
39                ver=`cat /tmp/ver`; \
40                ver=$((ver +1)); \
41                echo $ver > /tmp/ver; \
42                echo -n "release x.x"; \
43                echo "-dev #"$ver `date` "Build host" `hostname`
44
45
46# Copy 10K from the device /dev/sda1 into the file input.  Ordinarily
47# Mksquashfs given a device, fifo, or named socket will place that special file
48# within the Squashfs filesystem, this allows input from these special
49# files to be captured and placed in the Squashfs filesystem.
50input f 444 root root dd if=/dev/sda1 bs=1024 count=10
51
52
53# Creating a block or character device examples
54
55# Create a character device "chr_dev" with major:minor 100:1 and
56# a block device "blk_dev" with major:minor 200:200, both with root
57# uid/gid and a mode of rw-rw-rw.
58chr_dev c 666 root root 100 1
59blk_dev b 666 0 0 200 200
60
61
62# Creating a directory example
63
64# create a directory "pseudo_dir" with root uid/gid and mode of r--r--r--.
65pseudo_dir d 444 root root
66
67
68# Modifying attributes of an existing file exmaple
69
70# Change the attributes of the file "INSTALL" in the filesystem to have
71# root uid/gid and a mode of rw-rw-rw, overriding the attributes obtained
72# from the source filesystem.
73INSTALL m 666 root root
74
75