about summary refs log tree commit diff stats
Commit message (Expand)AuthorAgeFilesLines
...
| * | | core apparmor fstabSilvino Silva2018-04-031-0/+6
| * | | iptables script revisionSilvino Silva2018-04-031-154/+223
| * | | apparmor and hardening revisionSilvino Silva2018-04-032-10/+24
| * | | dev php testingSilvino Silva2018-04-032-1/+51
| * | | tools iptables revisionSilvino Silva2018-04-032-142/+167
| * | | fstab to check file systemsSilvino Silva2018-04-031-8/+8
| * | | dev c lib and index revisionSilvino Silva2018-04-032-128/+218
| * | | tools storage, qemu, lvm revisionSilvino Silva2018-03-124-13/+87
| * | | dev c added initial librariesSilvino Silva2018-03-126-211/+419
| * | | core linux better config documentationSilvino Silva2018-03-103-242/+786
| * | | core linux kernel revisionSilvino Silva2018-03-086-319/+40
| * | | core linux and reboot revisionSilvino Silva2018-03-082-11/+10
| * | | core linux-gnu port updatedSilvino Silva2018-03-0814-5507/+1710
| * | | core reboot and linux revisionSilvino Silva2018-03-083-63/+44
| * | | dev c datatypes initial documentSilvino Silva2018-03-072-2/+107
| * | | dev c added datatypes and debuggingSilvino Silva2018-03-073-0/+103
| * | | dev c revisionSilvino Silva2018-03-073-69/+274
| * | | tools lvm resizeSilvino Silva2018-03-061-0/+24
| * | | added extra packages to install coreSilvino Silva2018-03-061-1/+6pre { line-height: 125%; } td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#!/usr/bin/perl

use strict;
use warnings;

use IPC::Run3 |   
Merge branch 'h-0.3.2' into developSilvino Silva2017-10-0930-475/+1275
|\ \ \ | | |/ | |/|
| * | tools iptables script revision, bridge from ethernetSilvino Silva2017-09-241-137/+200
| * | tools user pkgmk get settings from systemSilvino Silva2017-09-241-25/+5
| * | dev c system dev added more gdb infoSilvino Silva2017-09-151-0/+23
| * | dev c language system dev revisionSilvino Silva2017-09-153-86/+161
| * | fix tools gitolite cron deploy callSilvino Silva2017-09-051-2/+2
| * | added logrotate configurationSilvino Silva2017-09-0312-0/+261
| * | added syslog-ng configuration, fix link to configurationSilvino Silva2017-08-272-1/+182
| * | tools syslogng added link to tools indexSilvino Silva2017-08-231-0/+5
| * | core ports revision, simple configurationSilvino Silva2017-08-231-35/+19
| * | fix setup-install fstabSilvino Silva2017-08-111-9/+7
| * | tools qemu and core setup scripts revisionSilvino Silva2017-08-068-179/+409
| * | bumped version 0.3.2Silvino Silva2017-08-021-1/+1
| |/
| * new release 0.3.1Silvino Silva2017-08-0296-8274/+24809
| |\
| * \ New release 0.3.0Silvino Silva2017-02-0140-673/+2137
| |\ \
| * \ \ release 0.2.7Silvino Silva2016-10-213-12/+48
| |\ \ \
| * \ \ \ release 0.2.6Silvino Silva2016-10-1618-794/+253
| |\ \ \ \
* | \ \ \ \ Merge branch 'r-0.3.1' into developSilvino Silva2017-08-0293-8206/+24760
|\ \ \ \ \ \ | | |_|_|_|/ | |/| | | |
ext; } push @{ $profile{$prof}{exclude} }, $key and next if $config->{$prof}->{$key} eq "exclude"; push @{ $profile{$prof}{backup} }, $key; } } my $date = date(); my $backup_dir = $options{backup_dir} || "/tmp/backups"; my @gpg_recipients; @gpg_recipients = split / /, $options{gpg_recipients} if $options{gpg_recipients}; my $gpg_bin = $options{gpg_bin} || "gpg"; warn "[WARN] \$gpg_bin is set to `$gpg_bin'" unless $gpg_bin =~ /^(gpg2?)$/; # Print help. HelpMessage() and exit 0 if scalar @ARGV == 0 or $options{help}; # Parsing the arguments. foreach my $prof ( @ARGV ) { if ( $profile{ $prof } ) { print "-------- $prof"; print " [Encrypt]" if $profile{$prof}{L_ENCRYPT}; print " [Sign]" if $profile{$prof}{L_SIGN}; print " [Signify]" if $profile{$prof}{L_SIGNIFY}; print " [gzip]" if $profile{$prof}{L_GZIP}; print "\n"; my $file = "$backup_dir/${prof}/${date}.tar"; $file .= ".gz" if $profile{$prof}{L_GZIP}; path("$backup_dir/${prof}")->mkpath; # Create backup directory. backup($prof, $file); my $is_gpg_req = 1 if $profile{$prof}{L_SIGN} or $profile{$prof}{L_ENCRYPT}; encrypt_sign($prof, $file) if $is_gpg_req; # gpg would've removed the `.tar' file. $file = "${file}.gpg" if $is_gpg_req; signify($prof, $file) if $profile{$prof}{L_SIGNIFY}; } else { warn "[WARN] leo: no such profile :: `$prof' \n"; } } sub backup { my $prof = shift @_; my $tar_file = shift @_; my @options = ("-C", "/"); push @options, "-z" if $profile{$prof}{L_GZIP}; my @backup_paths; foreach my $path ($profile{$prof}{backup}->@*) { # If it's a directory then walk it upto 1 level. if (-d $path) { my $iter = path($path)->iterator(); while ( my $iter_path = $iter->() ) { push @backup_paths, path( $iter_path ); } } else { push @backup_paths, path( $path ); } } # Remove files that are to be excluded. foreach my $exclude ($profile{$prof}{exclude}->@*) { @backup_paths = grep !/$exclude/, @backup_paths; } # All paths should be relative to '/'. @backup_paths = map { $_->relative('/') } @backup_paths; tar_create($tar_file, @options, @backup_paths); $? # tar returns 1 on errors. ? die "Backup creation failed :: $?\n" : print "Backup: $tar_file\n"; path($tar_file)->chmod(0600); print "File was compressed with gzip(1).\n" if $profile{$prof}{L_GZIP} and $options{verbose}; tar_list($tar_file) if $options{verbose}; } # Encrypt, Sign backups. sub encrypt_sign { my $prof = shift @_; my $file = shift @_; my @options = (); push @options, "--default-key", $options{gpg_fingerprint} if $options{gpg_fingerprint}; if ( $profile{$prof}{L_ENCRYPT} ) { push @options, "--encrypt"; push @options, "--recipient", $options{gpg_fingerprint} if $options{gpg_fingerprint}; push @options, "--recipient", $_ foreach @gpg_recipients; } push @options, "--sign" if $profile{$prof}{L_SIGN}; push @options, "--verbose" if $options{verbose}; run3 [$gpg_bin, "--yes", "-o", "${file}.gpg", @options, $file]; $? # We assume non-zero is an error. ? die "GPG failed :: $?\n" : print "GPG: $file.gpg\n"; unlink $file or warn "[WARN] Could not delete `$file': $!\n"; path("$file.gpg")->chmod(0600); } sub signify { my $prof = shift @_; my $file = shift @_; my @options = ( "-S", "-s", $options{signify_seckey}, "-m", $file, "-x", "${file}.sig", ); run3 ["signify", @options]; $? # Non-zero exit code is an error. ? die "Signify failed :: $?\n" : print "Signify: ${file}.sig\n"; } sub HelpMessage { print qq{Backup files to $backup_dir. Profile:\n}; foreach my $prof (sort keys %profile) { print " $prof"; if ($options{verbose}) { print " [Encrypt]" if $profile{$prof}{L_ENCRYPT}; print " [Sign]" if $profile{$prof}{L_SIGN}; print " [Signify]" if $profile{$prof}{L_SIGNIFY}; print " [gzip]" if $profile{$prof}{L_GZIP}; print "\n"; print " + $_\n" foreach $profile{$prof}{backup}->@*; print " - $_\n" foreach $profile{$prof}{exclude}->@*; } print "\n"; } print qq{Options: --version [$version] --verbose --help }; } sub tar_create { run3 ["/bin/tar", "cf", @_]; } sub tar_list { print "\n"; run3 ["/bin/tar", "tvf", @_]; print "\n";} sub date { return strftime '%FT%T%z', gmtime() }