MrRockchip

kolibri_src.sh

Jan 24th, 2022 (edited)
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. #!/bin/sh
  2. # https://pastebin.com/HCQRyJVc
  3. # $1 - sha256sum, $2 - filename, $3 - intro comment, $4 - outro comment
  4. sha256sum_checker () {
  5. sha256sum_correct="$1 $2"
  6. sha256sum_my=$(sha256sum "$2")
  7. printf "\n=== sha256sum should be\n$sha256sum_correct\n"
  8. if [ "$sha256sum_my" = "$sha256sum_correct" ] ; then
  9. printf "^^^ this is correct, will $3 $2 $4 now...\n"
  10. return 0
  11. else
  12. printf "^^^ ! MISMATCH ! Check sha256sum manually: sha256sum $2\n"
  13. return 1
  14. fi
  15. }
  16. # $1 - main source file to be sedded, $2 - included source file name,
  17. # $3 - included source file path
  18. ext_sed () {
  19. printf "sed -i -e \"s|../../$3$2|./external/$2|g\" \"$1\"\n"
  20. sed -i -e "s|../../$3$2|./external/$2|g" "$1"
  21. }
  22. # $1 - source file or directory to be exported, $2 - its subdir path at KolibriOS SVN,
  23. # $3 - its save path
  24. svn_exp () {
  25. rm -rf "./$3"
  26. printf "svn export \"svn://kolibrios.org/programs/$2$1\" \"$3\"\n"
  27. svn export "svn://kolibrios.org/programs/$2$1" "$3"
  28. }
  29. # $1 - main source file to be sedded, $2 - included source file name,
  30. # $3 - included source file path
  31. exp_sed () {
  32. svn_exp "$2" "$3" "$2"
  33. ext_sed "$1" "$2" "$3"
  34. }
  35. # $1 - main source file to be sedded
  36. exp_sed_der () {
  37. exp_sed "$1" "macros.inc"
  38. exp_sed "$1" "proc32.inc"
  39. exp_sed "$1" "dll.inc"
  40. exp_sed "$1" "network.inc"
  41. exp_sed "$1" "struct.inc"
  42. exp_sed "$1" "box_lib.mac" "develop/libraries/box_lib/trunk/"
  43. }
  44. # $1 - save path for a file being downloaded, $2 - file ID at KolibriOS Forum,
  45. # $3 - sha256sum, $4 - intro comment, $5 - outro comment
  46. wget_sha256 () {
  47. rm -f "$1"
  48. wget "--no-check-certificate" "--output-document=$1" "https://board.kolibrios.org/download/file.php?id=$2"
  49. if [ -f "$1" ] ; then
  50. wgetter_file_size=$(($( wc -c < "$1" )))
  51. if [ "$wgetter_file_size" -eq "0" ] ; then
  52. rm -f "$1"
  53. fi
  54. fi
  55. if [ ! -f "$1" ] ; then
  56. printf "\nWARNING: can't download a $1 file !"
  57. printf "\n Please check your Internet connection and try again.\n"
  58. exit 1
  59. else
  60. if sha256sum_checker "$3" "$1" "$4" "$5" ; then
  61. return 0
  62. else
  63. return 1
  64. fi
  65. fi
  66. }
  67. # $1 - directory name to be packed as a dirname.7z
  68. packer () {
  69. rm -f "./$1.7z"
  70. 7za "a" "-m0=Deflate" "$1.7z" "$1"
  71. }
  72. # MAIN BODY
  73. svn_exp "ircc/" "network/" "./ircc_vcrpt/"
  74. cd "./ircc_vcrpt/"
  75. if wget_sha256 "./TLS-Library-RNG.zip" "8781" "0ede9e511fc10f05a11b992808a893b315604b25bbccbd10759202788013cec3" "extract an" "archive" ; then
  76. unzip "./TLS-Library-RNG.zip"
  77. # rm -f "./TLS-Library-RNG.zip"
  78. if wget_sha256 "./vcrpt.diff" "10337" "efc32a0d3894f4a977dd8eebba3edb2af6ecb2c901a1edaa3845b46feb84cab5" "use a" "patch" ; then
  79. patch -p1 < "./vcrpt.diff"
  80. # rm -f "./vcrpt.diff"
  81. rm -rf "./external/"
  82. mkdir "./external/"
  83. cd "./external/"
  84. exp_sed_der "./../ircc.asm"
  85. cd "./../../"
  86. packer "./ircc_vcrpt"
  87. exit 0
  88. else
  89. cd "./../"
  90. exit 1
  91. fi
  92. else
  93. cd "./../"
  94. exit 1
  95. fi
Add Comment
Please, Sign In to add comment