aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authoragentcobra2018-09-20 08:00:52 +0200
committeragentcobra2018-09-20 08:00:52 +0200
commit3b5cef6e813e025e401b044cc1f291323a1a75e0 (patch)
treeb8c419e6377ccb284b1ef11c528c2b6db161f5fc
parenta0568e5602e2537580a7d37bb504ff357fb8ce58 (diff)
downloadaur-3b5cef6e813e025e401b044cc1f291323a1a75e0.tar.gz
fix makefile with correct info
-rw-r--r--wrapper.pl69
1 files changed, 18 insertions, 51 deletions
diff --git a/wrapper.pl b/wrapper.pl
index 0f732f620175..a62a5726d068 100644
--- a/wrapper.pl
+++ b/wrapper.pl
@@ -14,6 +14,8 @@ use File::Basename;
use POSIX qw(locale_h);
use locale;
+use version;
+
use Cwd 'abs_path';
use File::Basename;
@@ -160,34 +162,6 @@ sub bold {
return "\033[1m$_[0]\033[0m";
}
-###
-# Transform the version in a integer
-#
-# @param String vA.B.C
-#
-# @return Int Integer (10000*A + 100 *B + C)
-sub version {
- # Remove the first character
- my @tmp = split //, $_[0];
- shift @tmp;
- my $ver = join '', @tmp;
-
- # Parse the 3 values
- my ($a, $b, $c)= split /\./, $ver;
- return 10000*$a + 100*$b + $c;
-}
-
-# ----------- Bypass Check priority ------------ #
-for(my $i=0; $i < $#ARGV+1; $i++) {
- my $arg = $ARGV[$i];
-
- # Bypass the check and launch
- if( $arg eq '--bypass-check' ) {
- push @warnings, $lang{'bypass'};
- goto START_SHADOW;
- }
-}
-
# ----------- Variables ------------ #
# Messages variables
@@ -219,29 +193,15 @@ my @warnings = ();
my $version = 'Standalone wrapper';
-# -------- AppImage -------- #
+# -------- Update -------- #
if( -d 'opt' ) {
# AppImage detection
$isAppImg = 1;
$version = 'Nightly build';
-}
-# ----------- Bypass Check priority ------------ #
-for(my $i=0; $i < $#ARGV+1; $i++) {
- my $arg = $ARGV[$i];
-
- # Bypass the check and launch
- if( $arg eq '--bypass-check' ) {
- push @warnings, $lang{'bypass'};
- goto START_SHADOW;
- }
-}
-
-# -------- Update -------- #
-if( $isAppImg ) {
if( -f 'shadow-appimage-version' ) {
- Local version
+ # Local version
open(my $fh, '<:encoding(UTF-8)', 'shadow-appimage-version')
or die "Could not open file 'shadow-appimage-version' $!";
$version = <$fh>;
@@ -251,11 +211,11 @@ if( $isAppImg ) {
if( substr($version, 0, 1) eq 'v' ) {
# Distant version
- my $distantVersion = `wget -q -O - https://gitlab.com/api/v4/projects/7962701/repository/tags | jq -r -c 'map(select(.release!=null))|.[0]|.["release"]|.["tag_name"]'`;
+ my $distantVersion = `curl https://gitlab.com/api/v4/projects/7962701/repository/tags | jq -r -c 'map(select(.release!=null))|.[0]|.["release"]|.["tag_name"]'`;
chomp $distantVersion;
# Update available
- if( version($version) < version($distantVersion) ) {
+ if( version->parse($version) < version->parse($distantVersion) ) {
print "\nNEW UPDATE AVAILABLE: $distantVersion\n";
alert('New version of the AppImage', "\nA new version of the AppImage is available on the server ($distantVersion)\n");
}
@@ -280,6 +240,12 @@ for(my $i=0; $i < $#ARGV+1; $i++) {
exit;
}
+ # Bypass the check and launch
+ if( $arg eq '--bypass-check' ) {
+ push @warnings, $lang{'bypass'};
+ goto START_SHADOW;
+ }
+
# Start directly ClientSDL and stops
if( $arg eq '--clientsdl' ) {
if( $isAppImg ) {
@@ -340,6 +306,7 @@ for(my $i=0; $i < $#ARGV+1; $i++) {
}
+
# -------- NVIDIA check -------- #
if( index(`lspci | grep 'VGA'`, 'NVIDIA') != -1 ) {
@@ -348,7 +315,7 @@ if( index(`lspci | grep 'VGA'`, 'NVIDIA') != -1 ) {
# Currently on the NVIDIA GPU
if( index(`nvidia-smi -L`, 'GPU ') != 1 ) {
- push @warnings, $lang{'vainfo-optimus'};
+ push @errors, $lang{'vainfo-optimus'};
}
# Only NVIDIA GPU available
@@ -451,11 +418,11 @@ if( scalar @errors > 0 ) {
if( $strace ) {
system("$langF strace -f $pathExec &> /var/tmp/strace_shadowbeta");
- # Create the compressed archive in the user directory
- system('tar -zcvf ~/strace_shadowbeta.tar.gz /var/tmp/strace_shadowbeta');
+ # Create the compressed archive in the user directory
+ system('tar -zcvf ~/strace_shadowbeta.tar.gz /var/tmp/strace_shadowbeta');
- # Remove the uncompressed strace
- system('rm /var/tmp/strace_shadowbeta');
+ # Remove the uncompressed strace
+ system('rm /var/tmp/strace_shadowbeta');
# Start Shadow
} else {