File: create_loopback_file.in

package info (click to toggle)
yard 1.17.patch1-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 600 kB
  • ctags: 74
  • sloc: perl: 1,729; sh: 250; makefile: 176; asm: 32
file content (25 lines) | stat: -rw-r--r-- 684 bytes parent folder | download
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
#!/usr/bin/perl
#  $Id: create_loopback_file.in,v 1.1.1.1 1998/02/21 11:40:04 fawcett Exp $
#
#  CREATE_LOOPBACK_FILE: Create an empty temporary file for use with
#  the loopback device.
#

package main;
require "Config.pl";
BEGIN { require "yard_utils.pl" } # Defines info() and error() for compiler

if (-e $CFG::device) {
    if (-b _ or -c _) {
	error "$CFG::device is the name of an existing device.\n";
    } elsif (-f _) {
	info 0, "Deleting existing file $CFG::device\n";
	unlink($CFG::device);
    }
}

print "Creating $CFG::fs_size K file on $CFG::device to be used as root filesystem\n";

sys("dd if=/dev/zero bs=1k of=$CFG::device count=$CFG::fs_size");

print "Done.\n";