Advertisement
Guest User

Create Debian/Ubuntu repositary

a guest
Feb 11th, 2013
1,192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.19 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3.  # password for DEB-GPG-KEY
  4.  key_pass="password"
  5.  
  6. _soft1=soft/binary-i386
  7. _soft2=soft/binary-x86_64
  8. p_soft1=dists/nobody/soft/binary-i386/Packages
  9. p_soft2=dists/nobody/soft/binary-x86_64/Packages
  10.  
  11. # i386
  12. dpkg-scanpackages -m pool/soft > $p_soft1
  13. cat $p_soft1 | gzip -9c > $p_soft1.gz
  14. cat $p_soft1 | bzip2 -9 > $p_soft1.bz2
  15.  
  16. # x86_64
  17. dpkg-scanpackages -m pool/soft > $p_soft2
  18. cat $p_soft2 | gzip -9c > $p_soft2.gz
  19. cat $p_soft2 | bzip2 -9 > $p_soft2.bz2
  20.  
  21. cd dists/nobody
  22.  
  23. # Create the Repositary Release file
  24.  
  25. cat > Release << END
  26. Origin: nobody
  27. Label: nobody repo
  28. Suite: nobody
  29. Codename: nobody
  30. Version: 1.0
  31. Architectures: i386
  32. Components: soft
  33. Description: nobody 1.0 repo
  34. MD5Sum:
  35. END
  36.  
  37. # Create Relases
  38.  
  39. cd $_soft1
  40. cat > Release << END
  41. Archive: nobody
  42. Version: 1.0
  43. Component: soft
  44. Origin: nobody
  45. Label: nobody packages
  46. Architecture: i386
  47. Description: nobody 1.0 repo
  48. END
  49.  
  50. cd ../../$_soft2
  51. cat > Release << END
  52. Archive: nobody
  53. Version: 1.0
  54. Component: soft
  55. Origin: nobody
  56. Label: nobody packages
  57. Architecture: x86_64
  58. Description: nobody 1.0 repo
  59. END
  60.  
  61. cd ../..
  62.  
  63. # MD5Sum Calculate for all files
  64.  
  65. # i386
  66.  
  67. md5sum=$(md5sum "$_soft1/Packages" | cut -d ' ' -f1)
  68. sizeinbytes=$(ls -l "$_soft1/Packages" | cut -d ' ' -f5)
  69. printf " "$md5sum" %1d $_soft1/Packages" $sizeinbytes >> Release
  70. printf "\n" >> Release
  71. md5sum=$(md5sum "$_soft1/Packages.bz2" | cut -d ' ' -f1)
  72. sizeinbytes=$(ls -l "$_soft1/Packages.bz2" | cut -d ' ' -f5)
  73. printf " "$md5sum" %1d $_soft1/Packages.bz2" $sizeinbytes >> Release
  74. printf "\n" >> Release
  75. md5sum=$(md5sum "$_soft1/Packages.gz" | cut -d ' ' -f1)
  76. sizeinbytes=$(ls -l "$_soft1/Packages.gz" | cut -d ' ' -f5)
  77. printf " "$md5sum" %1d $_soft1/Packages.gz" $sizeinbytes >> Release
  78. printf "\n" >> Release
  79. md5sum=$(md5sum "$_soft1/Release" | cut -d ' ' -f1)
  80. sizeinbytes=$(ls -l "$_soft1/Release" | cut -d ' ' -f5)
  81. printf " "$md5sum" %1d $_soft1/Release" $sizeinbytes >> Release
  82. printf "\n" >> Release
  83.  
  84. # x86_64
  85.  
  86. md5sum=$(md5sum "$_soft2/Packages" | cut -d ' ' -f1)
  87. sizeinbytes=$(ls -l "$_soft2/Packages" | cut -d ' ' -f5)
  88. printf " "$md5sum" %1d $_soft2/Packages" $sizeinbytes >> Release
  89. printf "\n" >> Release
  90.  
  91. md5sum=$(md5sum "$_soft2/Packages.bz2" | cut -d ' ' -f1)
  92. sizeinbytes=$(ls -l "$_soft2/Packages.bz2" | cut -d ' ' -f5)
  93. printf " "$md5sum" %1d $_soft2/Packages.bz2" $sizeinbytes >> Release
  94. printf "\n" >> Release
  95.  
  96. md5sum=$(md5sum "$_soft2/Packages.gz" | cut -d ' ' -f1)
  97. sizeinbytes=$(ls -l "$_soft2/Packages.gz" | cut -d ' ' -f5)
  98. printf " "$md5sum" %1d $_soft2/Packages.gz" $sizeinbytes >> Release
  99. printf "\n" >> Release
  100.  
  101. md5sum=$(md5sum "$_soft2/Release" | cut -d ' ' -f1)
  102. sizeinbytes=$(ls -l "$_soft2/Release" | cut -d ' ' -f5)
  103. printf " "$md5sum" %1d $_soft2/Release" $sizeinbytes >> Release
  104. printf "\n" >> Release
  105.  
  106. # Signing all files
  107.  
  108. printf "\n* Singning Repositary *\n"
  109. echo $key_pass | gpg --yes --no-use-agent --passphrase-fd 0 -bao Release.gpg Release
  110.  
  111. printf "\n* Singning i386 *\n"
  112. cd $_soft1
  113. echo $key_pass | gpg --yes --no-use-agent --passphrase-fd 0 -bao Release.gpg Release
  114.  
  115. printf "\n* Singning x86_64 *\n"
  116. cd ../../$_soft2
  117. echo $key_pass | gpg --yes --no-use-agent --passphrase-fd 0 -bao Release.gpg Release
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement