Merge branch 'main' of edna.lan:steffen/scripts
This commit is contained in:
commit
c6f43f5b0f
1 file changed
+71
-43
+71
-43
@@ -15,6 +15,7 @@ use Mojo::DOM;
|
||||
use File::Path qw(make_path);
|
||||
use Win32::Shortcut;
|
||||
use JSON;
|
||||
use File::Copy::Recursive qw(dirmove);
|
||||
|
||||
use LWP::Protocol::http;
|
||||
use LWP::Protocol::https;
|
||||
@@ -38,129 +39,121 @@ my $apps = {
|
||||
apiregex => 'solidcraft-(.*)-windows-x64-portable.zip',
|
||||
ext => 'zip',
|
||||
link => 'solidcraft.exe',
|
||||
mcp => 'solidcraft-cli.exe',
|
||||
folderinzip => 'same_as_file'
|
||||
mcp => 'solidcraft-cli.exe'
|
||||
},
|
||||
'gridcraft' => {
|
||||
apiurl => 'https://api.github.com/repos/storytold/gridcraft/releases',
|
||||
apiregex => 'gridcraft-(.*)-windows-x64-portable.zip',
|
||||
ext => 'zip',
|
||||
link => 'gridcraft.exe',
|
||||
mcp => 'gridcraft-cli.exe',
|
||||
folderinzip => 'same_as_file'
|
||||
mcp => 'gridcraft-cli.exe'
|
||||
},
|
||||
'photocraft' => {
|
||||
apiurl => 'https://api.github.com/repos/storytold/photocraft/releases',
|
||||
apiregex => 'photocraft-(.*)-windows-x64-portable.zip',
|
||||
ext => 'zip',
|
||||
link => 'photocraft.exe',
|
||||
mcp => 'photocraft-cli.exe',
|
||||
folderinzip => 'same_as_file'
|
||||
mcp => 'photocraft-cli.exe'
|
||||
},
|
||||
'vectorcraft' => {
|
||||
apiurl => 'https://api.github.com/repos/storytold/vectorcraft/releases',
|
||||
apiregex => 'vectorcraft-(.*)-windows-x64-portable.zip',
|
||||
ext => 'zip',
|
||||
link => 'vectorcraft.exe',
|
||||
mcp => 'vectorcraft-cli.exe',
|
||||
folderinzip => 'same_as_file'
|
||||
mcp => 'vectorcraft-cli.exe'
|
||||
},
|
||||
'filmcraft' => {
|
||||
apiurl => 'https://api.github.com/repos/storytold/filmcraft/releases',
|
||||
apiregex => 'filmcraft-(.*)-windows-x64-portable.zip',
|
||||
ext => 'zip',
|
||||
link => 'filmcraft.exe',
|
||||
mcp => 'filmcraft-cli.exe',
|
||||
folderinzip => 'same_as_file'
|
||||
mcp => 'filmcraft-cli.exe'
|
||||
},
|
||||
'lightcraft' => {
|
||||
apiurl => 'https://api.github.com/repos/storytold/lightcraft/releases',
|
||||
apiregex => 'lightcraft-(.*)-windows-x64-portable.zip',
|
||||
ext => 'zip',
|
||||
link => 'lightcraft.exe',
|
||||
mcp => 'lightcraft-cli.exe',
|
||||
folderinzip => 'same_as_file'
|
||||
mcp => 'lightcraft-cli.exe'
|
||||
},
|
||||
'pdfcraft' => {
|
||||
apiurl => 'https://api.github.com/repos/storytold/pdfcraft/releases',
|
||||
apiregex => 'pdfcraft-(.*)-windows-x64-portable.zip',
|
||||
ext => 'zip',
|
||||
link => 'pdfcraft.exe',
|
||||
mcp => 'pdfcraft-cli.exe',
|
||||
folderinzip => 'same_as_file'
|
||||
mcp => 'pdfcraft-cli.exe'
|
||||
},
|
||||
'effectcraft' => {
|
||||
apiurl => 'https://api.github.com/repos/storytold/effectcraft/releases',
|
||||
apiregex => 'effectcraft-(.*)-windows-x64-portable.zip',
|
||||
ext => 'zip',
|
||||
link => 'effectcraft.exe',
|
||||
mcp => 'effectcraft-cli.exe',
|
||||
folderinzip => 'same_as_file'
|
||||
mcp => 'effectcraft-cli.exe'
|
||||
},
|
||||
'designcraft' => {
|
||||
apiurl => 'https://api.github.com/repos/storytold/designcraft/releases',
|
||||
apiregex => 'designcraft-(.*)-windows-x64-portable.zip',
|
||||
ext => 'zip',
|
||||
link => 'designcraft.exe',
|
||||
mcp => 'designcraft-cli.exe',
|
||||
folderinzip => 'same_as_file'
|
||||
mcp => 'designcraft-cli.exe'
|
||||
},
|
||||
'figcraft' => {
|
||||
apiurl => 'https://api.github.com/repos/storytold/figcraft/releases',
|
||||
apiregex => 'figcraft-(.*)-windows-x64-portable.zip',
|
||||
ext => 'zip',
|
||||
link => 'figcraft.exe',
|
||||
mcp => 'figcraft-cli.exe',
|
||||
folderinzip => 'same_as_file'
|
||||
mcp => 'figcraft-cli.exe'
|
||||
},
|
||||
'wordcraft' => {
|
||||
apiurl => 'https://api.github.com/repos/storytold/wordcraft/releases',
|
||||
apiregex => 'wordcraft-(.*)-windows-x64-portable.zip',
|
||||
ext => 'zip',
|
||||
link => 'wordcraft.exe',
|
||||
mcp => 'wordcraft-cli.exe',
|
||||
folderinzip => 'same_as_file'
|
||||
mcp => 'wordcraft-cli.exe'
|
||||
},
|
||||
'soundcraft' => {
|
||||
apiurl => 'https://api.github.com/repos/storytold/soundcraft/releases',
|
||||
apiregex => 'soundcraft-(.*)-windows-x64-portable.zip',
|
||||
ext => 'zip',
|
||||
link => 'soundcraft.exe',
|
||||
mcp => 'soundcraft-cli.exe',
|
||||
folderinzip => 'same_as_file'
|
||||
mcp => 'soundcraft-cli.exe'
|
||||
},
|
||||
'deckcraft' => {
|
||||
apiurl => 'https://api.github.com/repos/storytold/deckcraft/releases',
|
||||
apiregex => 'deckcraft-(.*)-windows-x64-portable.zip',
|
||||
ext => 'zip',
|
||||
link => 'deckcraft.exe',
|
||||
mcp => 'deckcraft-cli.exe',
|
||||
folderinzip => 'same_as_file'
|
||||
mcp => 'deckcraft-cli.exe'
|
||||
},
|
||||
'cadcraft' => {
|
||||
apiurl => 'https://api.github.com/repos/storytold/cadcraft/releases',
|
||||
apiregex => 'cadcraft-(.*)-windows-x64-portable.zip',
|
||||
ext => 'zip',
|
||||
link => 'cadcraft.exe',
|
||||
mcp => 'cadcraft-cli.exe',
|
||||
folderinzip => 'same_as_file'
|
||||
mcp => 'cadcraft-cli.exe'
|
||||
},
|
||||
'Detect_It_Easy' => {
|
||||
apiurl => 'https://api.github.com/repos/horsicq/DIE-engine/releases',
|
||||
apiregex => 'die_win64_portable_(.*)_x64.zip',
|
||||
ext => 'zip',
|
||||
link => 'die.exe',
|
||||
folderinzip => 'die'
|
||||
link => 'die.exe'
|
||||
},
|
||||
'ghidra' => {
|
||||
apiurl => 'https://api.github.com/repos/NationalSecurityAgency/ghidra/releases',
|
||||
apiregex => 'ghidra_(.*)_PUBLIC_20261016.zip',
|
||||
ext => 'zip',
|
||||
link => 'ghidraRun.bat',
|
||||
folderinzip => 'ghidra_XXX_PUBLIC'
|
||||
link => 'ghidraRun.bat'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if ( !-d "C:\\temp" ) {
|
||||
make_path("C:\\temp");
|
||||
}
|
||||
if ( !-d "C:\\temp\\github" ) {
|
||||
make_path("C:\\temp\\github");
|
||||
}
|
||||
|
||||
my $ua = LWP::UserAgent->new(timeout => 10);
|
||||
$ua->max_redirect( 3 );
|
||||
$ua->agent('Mozilla/5.0 (compatible; AppDownloader/1.0)');
|
||||
@@ -173,6 +166,11 @@ for my $app ( sort keys %$apps ) {
|
||||
my $link = $apps->{$app}->{link} // undef;
|
||||
my $mcp = $apps->{$app}->{mcp} // undef;
|
||||
|
||||
if ( !$link ) {
|
||||
print "keine ausfuehrbare Datei\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
# 3. Request erstellen und Header für JSON setzen
|
||||
my $req = HTTP::Request->new(GET => $apiurl);
|
||||
$req->header('Accept' => 'application/vnd.github+json');
|
||||
@@ -211,9 +209,12 @@ for my $app ( sort keys %$apps ) {
|
||||
}
|
||||
|
||||
my $folderinzip = $apps->{$app}->{folderinzip} && $apps->{$app}->{folderinzip} eq 'same_as_file' ? $folder : $apps->{$app}->{folderinzip};
|
||||
$folderinzip = $folderinzip =~ s/XXX/$ver/r;
|
||||
|
||||
if ($folderinzip) {
|
||||
$folderinzip = $folderinzip =~ s/XXX/$ver/r;
|
||||
}
|
||||
|
||||
if ( -d "D:\\portable\\$app\\$ver" ) {
|
||||
if ( -e "D:\\portable\\$app\\$ver\\$link" ) {
|
||||
print "$app V$ver existiert\n";
|
||||
} else {
|
||||
if ( !-e $downloadfolder.$dateiname ) {
|
||||
@@ -228,26 +229,53 @@ for my $app ( sort keys %$apps ) {
|
||||
if ($status != 0) {
|
||||
die('Error in file!');
|
||||
} else {
|
||||
# entpacken der DAten in ein tempverzeichnis
|
||||
if ( !-d "C:\\temp\\github\\$app" ) {
|
||||
make_path("C:\\temp\\github\\$app");
|
||||
}
|
||||
|
||||
if ( !-d "D:\\portable\\$app" ) {
|
||||
make_path("D:\\portable\\$app");
|
||||
}
|
||||
if ( !-d "D:\\portable\\$app\\$ver" ) {
|
||||
make_path("D:\\portable\\$app\\$ver");
|
||||
}
|
||||
|
||||
# lesen
|
||||
my @inhalt = read_dir("D:\\portable\\$app\\$ver");
|
||||
if ( scalar @inhalt == 0 ) {
|
||||
print "entpacke $downloadfolder.$dateiname\n";
|
||||
$obj->extractTree($folderinzip, "D:\\portable\\$app\\$ver"); # extract files
|
||||
if ( scalar @inhalt == 0 ) {
|
||||
print "entpacke $downloadfolder$dateiname\n";
|
||||
my $err = $obj->extractTree(undef, "C:\\temp\\github\\$app"); # extract files
|
||||
}
|
||||
|
||||
my @inhaltnew = read_dir("C:\\temp\\github\\$app");
|
||||
|
||||
if ( -e "C:\\temp\\github\\$app\\$link" ) {
|
||||
dirmove("C:\\temp\\github\\$app", "D:\\portable\\$app\\$ver");
|
||||
} else {
|
||||
for my $in ( @inhaltnew ) {
|
||||
if ( -d "C:\\temp\\github\\$app\\$in" ) {
|
||||
if ( -e "C:\\temp\\github\\$app\\$in\\$link" ) {
|
||||
dirmove("C:\\temp\\github\\$app\\$in", "D:\\portable\\$app\\$ver");
|
||||
}
|
||||
}
|
||||
}
|
||||
rmtree "C:\\temp\\github\\$app";
|
||||
}
|
||||
|
||||
# alte Versionen löschen
|
||||
my @inhaltwithnewversion = read_dir("D:\\portable\\$app");
|
||||
for my $in ( @inhaltwithnewversion ) {
|
||||
next if $in eq $ver;
|
||||
if ( -d "D:\\portable\\$app\\$in" ) {
|
||||
rmtree "D:\\portable\\$app\\$in";
|
||||
}
|
||||
}
|
||||
|
||||
unlink($downloadfolder.$dateiname );
|
||||
print "zip datei von $app gelöscht\n";
|
||||
}
|
||||
# } else {
|
||||
# print "keine neue Version gefunden\n";
|
||||
}
|
||||
if ($link ) {
|
||||
if ($link && -e "D:\\portable\\$app\\$ver\\$link" ) {
|
||||
my $linknew = Win32::Shortcut->new();
|
||||
|
||||
if ( -e "C:\\Users\\steff\\Desktop\\$app.lnk" ) {
|
||||
@@ -265,7 +293,7 @@ for my $app ( sort keys %$apps ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( $mcp ) {
|
||||
if ( $mcp && -e "D:\\portable\\$app\\$ver\\$mcp" ) {
|
||||
my $mcpdata = {
|
||||
args => [
|
||||
"mcp"
|
||||
@@ -286,6 +314,6 @@ if ( $mcp_change ) {
|
||||
write_file($mcp_json_pfad, to_json($mcp_json, {utf8 => 1, pretty => 1}) )
|
||||
}
|
||||
|
||||
# system("pause");
|
||||
system("pause");
|
||||
|
||||
1;
|
||||
Reference in new issue
Block a user