-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy
More file actions
executable file
·73 lines (65 loc) · 2.5 KB
/
Copy pathdeploy
File metadata and controls
executable file
·73 lines (65 loc) · 2.5 KB
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
72
73
#!/usr/bin/perl
# Deploying config files. Overwrites everything. Only use if you know what to do.
use strict;
use warnings;
# Core modules
require Cwd;
require File::Basename;
require File::Spec;
# Get repository directory
my $repodir = File::Basename::dirname(Cwd::abs_path(__FILE__));
my $files = File::Spec->catdir($repodir, 'files');
# Create config skeletons for fluxbox, vim and more, if not existing.
# Perl has no good core modules for touching files and recursive creation of directory trees.
# Thus, we fall back to mkdir and touch here until a better implementation comes along.
system('mkdir -p ~/.fluxbox');
system('touch ~/.vimrc.more');
system('mkdir -p ~/.vim/autoload');
system('mkdir -p ~/.vim/bundle');
system('mkdir -p ~/.config/yamllint');
# Files for direct installation.
my %install = (
'Xdefaults' => '%HOME%/.Xdefaults',
'bashrc' => '%HOME%/.bashrc',
'gitconfig' => '%HOME%/.gitconfig',
'screenrc' => '%HOME%/.screenrc',
'tmux.conf' => '%HOME%/.tmux.conf',
'vimrc' => '%HOME%/.vimrc',
'zprofile' => '%HOME%/.zprofile',
'zshrc' => '%HOME%/.zshrc',
'yamllint.config' => '%HOME%/.config/yamllint/config',
'vim/autoload/pathogen.vim' => '%HOME%/.vim/autoload/pathogen.vim',
'fluxbox/startup' => '%HOME%/.fluxbox/startup',
);
while (my ($key, $to) = each %install) {
if (! -d $ENV{"HOME"}) {
die "Fatal: Homedir does not exist";
}
my $from = sprintf('%s/%s', $files, $key);
$to =~ s/%HOME%/$ENV{"HOME"}/;
printf("Install %s as %s\n", $from, $to);
system('/usr/bin/install', '-m', '0644', $from, $to);
}
my %vimgithub = (
'vim-gitgutter' => 'airblade/vim-gitgutter.git',
'vim-airline' => 'vim-airline/vim-airline.git',
'vim-airline-themes' => 'vim-airline/vim-airline-themes',
'vim-fugitive' => 'tpope/vim-fugitive.git',
'vim-puppet' => 'rodjek/vim-puppet',
'vim-terraform' => 'hashivim/vim-terraform',
'neocomplete' => 'Shougo/neocomplete',
);
# Update/Install plugins from github
# FIXME this is a huge security risk.
printf("Install/update vim modules from github.com:\n");
while (my ($module, $path) = each %vimgithub) {
chdir File::Spec->catdir($ENV{"HOME"}, '.vim', 'bundle') or die $!;
if ( -d $module) {
chdir $module;
printf(" * Update $module...\n");
system('git pull -q --ff');
} else {
printf(" * Install $module...\n");
system('git','clone', sprintf('https://github.com/%s', $path));
}
}