-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyfs-version
executable file
·72 lines (54 loc) · 1.29 KB
/
yfs-version
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/perl -w
# copyfs - copy on write filesystem http://n0x.org/copyfs/
# Copyright (C) 2004 Nicolas Vigier <[email protected]>
# Thomas Joubert <[email protected]>
# This program can be distributed under the terms of the GNU GPL.
# See the file COPYING.
use strict;
use warnings;
use IPC::Open3;
use IO::Select;
use POSIX qw(strftime);
use Fcntl ':mode';
use File::Basename;
use File::stat;
use Errno;
use Getopt::Std;
# Strip the path
$0 = basename($0);
my %options = ();
# Parse command line
getopts("cpnh", \%options);
if ($options{h})
{
printf("Usage: $0 [-c] [-p] [-n] [-h]\n");
printf("\n");
printf(" -h Show this help\n");
# Version management
printf(" -c commit a new version\n");
printf(" -p previous version\n");
printf(" -n next version\n");
exit(0);
}
# Show by default
$options{s} = 1
if (!$options{r} && !$options{g} && !$options{s} && !$options{l} &&
!$options{t} && !$options{u});
if ($options{c})
{
my $pid = qx`pidof yfs_client`;
kill 'SIGINT', $pid;
exit(0);
}
if ($options{p})
{
my $pid = qx`pidof yfs_client`;
kill 'SIGUSR1', $pid;
exit(0);
}
if ($options{n})
{
my $pid = qx`pidof yfs_client`;
kill 'SIGUSR2', $pid;
exit(0);
}