Advertisement
Guest User

Create Debian repositary

a guest
Feb 7th, 2013
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.80 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. # MD5Sum Calculate for all files
  38.  
  39. # i386
  40.  
  41. md5sum=$(md5sum "$_soft1/Packages" | cut -d ' ' -f1)
  42. sizeinbytes=$(ls -l "$_soft1/Packages" | cut -d ' ' -f5)
  43. printf " "$md5sum" %1d $_soft1/Packages" $sizeinbytes >> Release
  44. printf "\n" >> Release
  45. md5sum=$(md5sum "$_soft1/Packages.bz2" | cut -d ' ' -f1)
  46. sizeinbytes=$(ls -l "$_soft1/Packages.bz2" | cut -d ' ' -f5)
  47. printf " "$md5sum" %1d $_soft1/Packages.bz2" $sizeinbytes >> Release
  48. printf "\n" >> Release
  49. md5sum=$(md5sum "$_soft1/Packages.gz" | cut -d ' ' -f1)
  50. sizeinbytes=$(ls -l "$_soft1/Packages.gz" | cut -d ' ' -f5)
  51. printf " "$md5sum" %1d $_soft1/Packages.gz" $sizeinbytes >> Release
  52. printf "\n" >> Release
  53. md5sum=$(md5sum "$_soft1/Release" | cut -d ' ' -f1)
  54. sizeinbytes=$(ls -l "$_soft1/Release" | cut -d ' ' -f5)
  55. printf " "$md5sum" %1d $_soft1/Release" $sizeinbytes >> Release
  56. printf "\n" >> Release
  57.  
  58. # x86_64
  59.  
  60. md5sum=$(md5sum "$_soft2/Packages" | cut -d ' ' -f1)
  61. sizeinbytes=$(ls -l "$_soft2/Packages" | cut -d ' ' -f5)
  62. printf " "$md5sum" %1d $_soft2/Packages" $sizeinbytes >> Release
  63. printf "\n" >> Release
  64.  
  65. md5sum=$(md5sum "$_soft2/Packages.bz2" | cut -d ' ' -f1)
  66. sizeinbytes=$(ls -l "$_soft2/Packages.bz2" | cut -d ' ' -f5)
  67. printf " "$md5sum" %1d $_soft2/Packages.bz2" $sizeinbytes >> Release
  68. printf "\n" >> Release
  69.  
  70. md5sum=$(md5sum "$_soft2/Packages.gz" | cut -d ' ' -f1)
  71. sizeinbytes=$(ls -l "$_soft2/Packages.gz" | cut -d ' ' -f5)
  72. printf " "$md5sum" %1d $_soft2/Packages.gz" $sizeinbytes >> Release
  73. printf "\n" >> Release
  74.  
  75. md5sum=$(md5sum "$_soft2/Release" | cut -d ' ' -f1)
  76. sizeinbytes=$(ls -l "$_soft2/Release" | cut -d ' ' -f5)
  77. printf " "$md5sum" %1d $_soft2/Release" $sizeinbytes >> Release
  78. printf "\n" >> Release
  79.  
  80. # Signing all files
  81.  
  82. printf "\n* Singning Repositary *\n"
  83. echo $key_pass | gpg --yes --no-use-agent --passphrase-fd 0 -bao Release.gpg Release
  84.  
  85. printf "\n* Singning i386 *\n"
  86. cd $_soft1
  87. echo $key_pass | gpg --yes --no-use-agent --passphrase-fd 0 -bao Release.gpg Release
  88.  
  89. printf "\n* Singning x86_64 *\n"
  90. cd ../../$_soft2
  91. 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