3 # Generate systemd mount units based on information from fstab file.
5 # Copyright (C) 2012 Samsung Electronics
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # version 2 as published by the Free Software Foundation.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 # Author: Ćukasz Stelmach <l.stelmach@samsung.com>
25 my $out_dir = pop @ARGV;
26 my ($fs_dev, $fs_dir, $fs_type, $fs_opts, $fs_dump, $fs_pass);
28 sub name_from_path($) {
42 ($fs_dev, $fs_dir, $fs_type, $fs_opts, $fs_dump, $fs_pass)=split;
43 next unless ($fs_dev=~m/mmcblk/);
44 next unless ($fs_type=~m/ext[234]/);
46 my $fs_tab=abs_path $ARGV;
47 my $unit_name=$out_dir ."/". name_from_path($fs_dir) . ".mount";
48 my $devname=name_from_path $fs_dev;
49 my ($after,$req,$wants);
51 $after = "fsck-root.service resize2fs-root.service";
52 $req = "fsck-root.service";
53 $wants = "resize2fs-root.service";
55 $after = "fsck\@$devname.service resize2fs\@$devname.service";
56 $req = "fsck\@$devname.service";
57 $wants = "resize2fs\@$devname.service";
61 # Automaticall generated by mount-generator.pl
64 # FIXME: Is this required?
66 DefaultDependencies=no
67 Before=local-fs.target
69 After=local-fs-pre.target $after
78 open (UNIT, ">", $unit_name) || die $!;
79 print UNIT $unit,"\n";