Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # https://pastebin.com/HCQRyJVc
- # $1 - sha256sum, $2 - filename, $3 - intro comment, $4 - outro comment
- sha256sum_checker () {
- sha256sum_correct="$1 $2"
- sha256sum_my=$(sha256sum "$2")
- printf "\n=== sha256sum should be\n$sha256sum_correct\n"
- if [ "$sha256sum_my" = "$sha256sum_correct" ] ; then
- printf "^^^ this is correct, will $3 $2 $4 now...\n"
- return 0
- else
- printf "^^^ ! MISMATCH ! Check sha256sum manually: sha256sum $2\n"
- return 1
- fi
- }
- # $1 - main source file to be sedded, $2 - included source file name,
- # $3 - included source file path
- ext_sed () {
- printf "sed -i -e \"s|../../$3$2|./external/$2|g\" \"$1\"\n"
- sed -i -e "s|../../$3$2|./external/$2|g" "$1"
- }
- # $1 - source file or directory to be exported, $2 - its subdir path at KolibriOS SVN,
- # $3 - its save path
- svn_exp () {
- rm -rf "./$3"
- printf "svn export \"svn://kolibrios.org/programs/$2$1\" \"$3\"\n"
- svn export "svn://kolibrios.org/programs/$2$1" "$3"
- }
- # $1 - main source file to be sedded, $2 - included source file name,
- # $3 - included source file path
- exp_sed () {
- svn_exp "$2" "$3" "$2"
- ext_sed "$1" "$2" "$3"
- }
- # $1 - main source file to be sedded
- exp_sed_der () {
- exp_sed "$1" "macros.inc"
- exp_sed "$1" "proc32.inc"
- exp_sed "$1" "dll.inc"
- exp_sed "$1" "network.inc"
- exp_sed "$1" "struct.inc"
- exp_sed "$1" "box_lib.mac" "develop/libraries/box_lib/trunk/"
- }
- # $1 - save path for a file being downloaded, $2 - file ID at KolibriOS Forum,
- # $3 - sha256sum, $4 - intro comment, $5 - outro comment
- wget_sha256 () {
- rm -f "$1"
- wget "--no-check-certificate" "--output-document=$1" "https://board.kolibrios.org/download/file.php?id=$2"
- if [ -f "$1" ] ; then
- wgetter_file_size=$(($( wc -c < "$1" )))
- if [ "$wgetter_file_size" -eq "0" ] ; then
- rm -f "$1"
- fi
- fi
- if [ ! -f "$1" ] ; then
- printf "\nWARNING: can't download a $1 file !"
- printf "\n Please check your Internet connection and try again.\n"
- exit 1
- else
- if sha256sum_checker "$3" "$1" "$4" "$5" ; then
- return 0
- else
- return 1
- fi
- fi
- }
- # $1 - directory name to be packed as a dirname.7z
- packer () {
- rm -f "./$1.7z"
- 7za "a" "-m0=Deflate" "$1.7z" "$1"
- }
- # MAIN BODY
- svn_exp "ircc/" "network/" "./ircc_vcrpt/"
- cd "./ircc_vcrpt/"
- if wget_sha256 "./TLS-Library-RNG.zip" "8781" "0ede9e511fc10f05a11b992808a893b315604b25bbccbd10759202788013cec3" "extract an" "archive" ; then
- unzip "./TLS-Library-RNG.zip"
- # rm -f "./TLS-Library-RNG.zip"
- if wget_sha256 "./vcrpt.diff" "10337" "efc32a0d3894f4a977dd8eebba3edb2af6ecb2c901a1edaa3845b46feb84cab5" "use a" "patch" ; then
- patch -p1 < "./vcrpt.diff"
- # rm -f "./vcrpt.diff"
- rm -rf "./external/"
- mkdir "./external/"
- cd "./external/"
- exp_sed_der "./../ircc.asm"
- cd "./../../"
- packer "./ircc_vcrpt"
- exit 0
- else
- cd "./../"
- exit 1
- fi
- else
- cd "./../"
- exit 1
- fi
Add Comment
Please, Sign In to add comment