all in one
This commit is contained in:
parent
50d053f937
commit
5278ef744f
37
builder
37
builder
@ -7,13 +7,11 @@ set -Eeuo pipefail
|
||||
|
||||
trap cleanup SIGINT SIGTERM ERR EXIT
|
||||
|
||||
# Whoami
|
||||
ScriptFullname=$(readlink -e "$0")
|
||||
ScriptName=$(basename "$0")
|
||||
ScriptDir=$(dirname "$ScriptFullname")
|
||||
|
||||
# Useful things
|
||||
source "$ScriptDir/common.lib"
|
||||
|
||||
# Common
|
||||
SteamPath=$(reg_readkey "HKCU\Software\Valve\Steam" "SteamPath")
|
||||
DocumentsPath=$(reg_readkey "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Personal")
|
||||
@ -56,6 +54,39 @@ KFPublishLocalization="$KFPublish/Localization"
|
||||
MutWsInfo="$KFDoc/wsinfo.txt"
|
||||
KFEditorConfBackup="$KFEditorConf.backup"
|
||||
|
||||
function reg_readkey () # $1: path, $2: key
|
||||
{
|
||||
cygpath -u $(
|
||||
reg query "$1" //v "$2" | \
|
||||
grep -F "$2" | \
|
||||
awk '{ $1=$2=""; print $0 }' )
|
||||
}
|
||||
|
||||
function is_true () # $1: Bool arg to check
|
||||
{
|
||||
echo "$1" | grep -Piq '^true$'
|
||||
}
|
||||
|
||||
function get_latest () # $1: Reponame, $2: filename, $3: output filename
|
||||
{
|
||||
local ApiUrl="https://api.github.com/repos/$1/releases/latest"
|
||||
local LatestTag=$(curl --silent "$ApiUrl" | grep -Po '"tag_name": "\K.*?(?=")')
|
||||
local DownloadUrl="https://github.com/$1/releases/download/$LatestTag/$2"
|
||||
|
||||
mkdir -p "$(dirname "$3")/"
|
||||
curl -LJs "$DownloadUrl" -o "$3"
|
||||
}
|
||||
|
||||
function get_latest_multini () # $1: file to save
|
||||
{
|
||||
get_latest "GenZmeY/multini" "multini-windows-amd64.exe" "$1"
|
||||
}
|
||||
|
||||
function get_latest_kfeditor_patcher () # $1: file to save
|
||||
{
|
||||
get_latest "notpeelz/kfeditor-patcher" "kfeditor_patcher.exe" "$1"
|
||||
}
|
||||
|
||||
function show_help ()
|
||||
{
|
||||
cat <<EOF
|
||||
|
34
common.lib
34
common.lib
@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function reg_readkey () # $1: path, $2: key
|
||||
{
|
||||
cygpath -u $(
|
||||
reg query "$1" //v "$2" | \
|
||||
grep -F "$2" | \
|
||||
awk '{ $1=$2=""; print $0 }' )
|
||||
}
|
||||
|
||||
function is_true () # $1: Bool arg to check
|
||||
{
|
||||
echo "$1" | grep -Piq '^true$'
|
||||
}
|
||||
|
||||
function get_latest () # $1: Reponame, $2: filename, $3: output filename
|
||||
{
|
||||
local ApiUrl="https://api.github.com/repos/$1/releases/latest"
|
||||
local LatestTag=$(curl --silent "$ApiUrl" | grep -Po '"tag_name": "\K.*?(?=")')
|
||||
local DownloadUrl="https://github.com/$1/releases/download/$LatestTag/$2"
|
||||
|
||||
mkdir -p "$(dirname "$3")/"
|
||||
curl -LJs "$DownloadUrl" -o "$3"
|
||||
}
|
||||
|
||||
function get_latest_multini () # $1: file to save
|
||||
{
|
||||
get_latest "GenZmeY/multini" "multini-windows-amd64.exe" "$1"
|
||||
}
|
||||
|
||||
function get_latest_kfeditor_patcher () # $1: file to save
|
||||
{
|
||||
get_latest "notpeelz/kfeditor-patcher" "kfeditor_patcher.exe" "$1"
|
||||
}
|
Loading…
Reference in New Issue
Block a user