Repository navigation
Expand file tree
/
Copy pathdeploy.sh
More file actions
56 lines (52 loc) · 1.55 KB
/
Copy pathdeploy.sh
File metadata and controls
56 lines (52 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
# Linux Deploy Component
# (c) Anton Skshidlevsky <meefik@gmail.com>, GPLv3
do_configure()
{
msg ":: Configuring ${COMPONENT} ... "
if [ "${FAKEROOT}" = "1" ]; then
ln -sf /proc/mounts "${CHROOT_DIR}/etc/mtab"
else
rm -f "${CHROOT_DIR}/etc/mtab"
grep "${CHROOT_DIR}" /proc/mounts | sed "s|${CHROOT_DIR}/*|/|g" > "${CHROOT_DIR}/etc/mtab"
fi
return 0
}
do_start()
{
if [ "${FAKEROOT}" != "1" -a -n "${MOUNTS}" ]; then
msg ":: Mounting partitions: "
local item disk_src disk_dst target
for item in ${MOUNTS}
do
disk_src="${item%%:*}"
disk_dst="${item##*:}"
[ -n "${disk_src}" -a -n "${disk_dst}" ] || continue
msg -n "${disk_src} ... "
target="${CHROOT_DIR}/${disk_dst}"
if ! is_mounted "${target}" ; then
[ -d "${target}" ] || mkdir -p "${target}"
[ -e "${disk_src}" ] || mkdir -p "${disk_src}"
if [ -d "${disk_src}" ]; then
mount -o bind "${disk_src}" "${target}"
is_ok "fail" "done"
elif [ -e "${disk_src}" ]; then
mount -o rw,relatime "${disk_src}" "${target}"
is_ok "fail" "done"
else
msg "skip"
fi
else
msg "skip"
fi
done
fi
do_configure
}
do_help()
{
cat <<EOF
--mounts=SOURCE:TARGET ...
Подключение ресурсов к контейнеру.
EOF
}