Debian Codegraph @

examples/state-scripts/retain-systemd-network/Download_Leave_02

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 #
3 # Retain *.network files from the current root
4 #
5
6 echoscip-shell system . . echo. "$(catscip-shell system . . cat. /etc/mender/artifact_infoscip-shell filesystem . . `/etc/mender/artifact_info`.): Running $(basenamescip-shell system . . basename. "$0")" >&2
7
8 if [scip-shell system . . `[`. ! -x /sbin/fw_printenvscip-shell filesystem . . `/sbin/fw_printenv`. ]; then
9 exit 1
10 fi
11
12 current=$(/sbin/fw_printenvscip-shell filesystem . . `/sbin/fw_printenv`. mender_boot_part | awkscip-shell system . . awk. -F = '{ print $2 }')
13
14 if [scip-shell system . . `[`. $current = "2" ]; then
15 newroot=/dev/mmcblk0p3scip-shell filesystem . . `/dev/mmcblk0p3`.
16 elif [scip-shell system . . `[`. $current = "3" ]; then
17 newroot=/dev/mmcblk0p2scip-shell filesystem . . `/dev/mmcblk0p2`.
18 else
19 echoscip-shell system . . echo. "Unexpected current root: $current" >&2
20 exit 1
21 fi
22
23 mountscip-shell system . . mount. $newroot /mntscip-shell filesystem . . `/mnt`.
24
25 if [scip-shell system . . `[`. $? -ne 0 ]; then
26 echoscip-shell system . . echo. "Failed to mount $newroot" >&2
27 exit 1
28 fi
29
30 sleepscip-shell system . . sleep. 2
31
32 if [scip-shell system . . `[`. -d /mnt/etc/systemd/networkscip-shell filesystem . . `/mnt/etc/systemd/network`. ]; then
33 networks=$(lsscip-shell system . . ls. -l /mnt/etc/systemd/network/*.network 2>/dev/nullscip-shell filesystem . . `/dev/null`. | wcscip-shell system . . wc. -l)
34
35 cpscip-shell system . . cp. /etc/systemd/network/*.network /mnt/etc/systemd/networkscip-shell filesystem . . `/mnt/etc/systemd/network`.
36 echoscip-shell system . . echo. "Copied /etc/systemd/network to newroot partition" >&2
37 else
38 echoscip-shell system . . echo. "Failed to find a /etc/systemd/network on newroot partition" >&2
39 exit 1
40 fi
41
42 umountscip-shell system . . umount. $newroot
43