diff options
author | davidovski <david@davidovski.xyz> | 2022-01-30 02:34:51 +0000 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-01-30 02:34:51 +0000 |
commit | 4a5d2a3c22096c563608ce2e3603ea40810f030b (patch) | |
tree | 20a4cec9c6b010598c562d8f38faa11b19e41909 /src/XibUtil.pm | |
parent | d4d14ed58d10ee3e5a71d6e664409c1283529406 (diff) |
moved everything to bash again
Diffstat (limited to 'src/XibUtil.pm')
-rw-r--r-- | src/XibUtil.pm | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/src/XibUtil.pm b/src/XibUtil.pm deleted file mode 100644 index 1aa02a8..0000000 --- a/src/XibUtil.pm +++ /dev/null @@ -1,52 +0,0 @@ -package XibUtil; - -use v5.12; - -use strict; -use warnings; - -use File::Basename; - -sub md5_sum{ - my ($file) = @_; - - open(my $fh, "<", $file) or die "Cannot open $file: $!"; - binmode($fh); - - return Digest::MD5->new->addfile($fh)->hexdigest; -} - -sub extract_from_file{ - my ($file, $regex) = @_; - open (my $fh, "<", $file) or warn "Cannot open $file"; - while (my $line = <$fh>) { - if ($line =~ $regex) { - return $1; - } - } -} - -sub is_git_repo{ - return system("git ls-remote -q @_"); -} - -sub extract{ - my ($file) = @_; - my $ext = (fileparse($file, qr/\.[^.]*/))[2]; - print("$ext\n"); - - my $cmd = ""; - given($ext) { - $cmd = "tar -zxf $file" when ".gz"; - $cmd = "tar -xf $file" when ".xz"; - $cmd = "unzip $file" when ".zip"; - $cmd = "tar --lzip -xf $file" when ".lz"; - default { - $cmd = "tar -xf $file"; - } - } - - system($cmd); -} - -1; |