-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_install.pl
executable file
·58 lines (47 loc) · 1.92 KB
/
build_install.pl
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
#!/usr/bin/perl
use POSIX qw(strftime);
use warnings;
use strict;
MAIN: {
# Delete old install:
#`rm -rf ~/.juniper_networks && rm -rf ~/.local/share/applications/jhpulse.desktop && rm -rf ~/.jhpulse`;
# Create .jhpulse directory and copy the files in
if( -d "$ENV{HOME}/.jhpulse" ) {
my $datestr = strftime('%Y-%m-%d-%H-%M-%S',localtime);
my $backup_archive_name = "$ENV{HOME}/.jhpulse-$datestr.bak.tar.gz";
print "Backing up current .jhpulse directory to $backup_archive_name...\n";
`sudo tar -pczf $backup_archive_name ~/.jhpulse`;
`sudo rm -rf ~/.jhpulse`;
}
`cp -R jhpulse ~/.jhpulse`;
#Check for required packages and install if necessary.
my @packages = ('curl', 'firefox', 'gcc-multilib', 'libc6:i386', 'zlib1g:i386', 'libgtk2-perl', 'libwww-perl', 'tar', 'wget', 'unzip');
for my $package (@packages) {
my $check = `dpkg -s $package 2>/dev/null | grep Status`;
chomp $check;
if ($check eq '') {
print "Missing package $package.\n Installing...\n";
`sudo apt-get -y install $package`;
}
}
# Compile ncui
`cd ~/.jhpulse && gcc -m32 -Wl,-rpath,\`pwd\` -o ncui libncui.so`;
# Set ownership/permissions on files.
my $username = $ENV{LOGNAME} || $ENV{USER} || getpwuid($<);
`sudo chown -R $username ~/.jhpulse`;
`sudo chmod -R 500 ~/.jhpulse`;
`sudo chown root:root ~/.jhpulse/ncsvc`;
`sudo chown root:root ~/.jhpulse/ncui`;
`sudo chmod 4711 ~/.jhpulse/ncsvc`;
`sudo chmod 4711 ~/.jhpulse/ncui`;
`sudo chmod g+s ~/.jhpulse/ncsvc`;
`sudo chmod g+s ~/.jhpulse/ncui`;
`chmod u+w ~/.jhpulse/jhpulse.log`;
`chmod 600 ~/.jhpulse/DSID`;
`chmod u+w ~/.jhpulse`;
# Create link to messed up hardcoded ncsvc log to the proper directory
`ln -s ~/.juniper_networks/network_connect/ncsvc.log ~/.jhpulse/ncsvc.log`;
# Remove "installer", run JHPulse.
#`perl ~/.jhpulse/jhpulse`;
print "Installation completed! You should be able to find JHPulse in your application menu.\n\n";
}