形式
Lua
投稿日時
2020-01-27 22:17
公開期間
無期限
  1. #!/usr/bin/lua
  2. print('Please install git before using this lua file!')
  3. os.execute('rm pkgbuild.list && *.spec')
  4. function dir_exists(path)
  5. if type(path) ~= 'string' then
  6. error('input error')
  7. return false
  8. end
  9. local response = os.execute('cd ' .. path)
  10. if response == nil then
  11. return false
  12. end
  13. return response
  14. end
  15. if dir_exists('packages') then
  16. print('Warning: Please confirm that the packages folder is the folder for storage ArchLinux file!')
  17. os.execute('cd packages && proxychains -q git pull origin master')
  18. else
  19. os.execute('proxychains -q git clone https://git.archlinux.org/svntogit/packages.git')
  20. end
  21. os.execute('find packages/ -name PKGBUILD | grep repos >> pkgbuild.list')
  22. pkgbuild = io.open('pkgbuild.list', 'r')
  23. specname = {}
  24. for names in pkgbuild:lines() do
  25. local strings = string.match(names, 'packages/([A-Za-z0-9-.]+)') .. '.spec'
  26. table.insert(specname, strings)
  27. end
  28. pkgbuild:close()
  29. pkgbuild = io.open('pkgbuild.list', 'r')
  30. addresslist = {}
  31. for address in pkgbuild:lines() do
  32. local strings = string.sub(address, 1, -1)
  33. table.insert(addresslist, strings)
  34. end
  35. pkglist = {}
  36. f = {}
  37. for i = 1, #addresslist do
  38. pkglist[i] = io.open(addresslist[i], 'r')
  39. local content = pkglist[i]:read('*all')
  40. pkglist[i]:close()
  41. content = string.gsub(content, '/usr/share/doc', '%%{_docdir}')
  42. content = string.gsub(content, '/usr/share/man', '%%{_mandir}')
  43. content = string.gsub(content, '/usr/share/info', '%%{_infodir}')
  44. content = string.gsub(content, '/usr/share', '%%{_datadir}')
  45. content = string.gsub(content, '/usr/sbin', '%%{_sbindir}')
  46. content = string.gsub(content, '/usr/libexec', '%%{_libexecdir}')
  47. content = string.gsub(content, '/usr/lib', '%%{_libdir}')
  48. content = string.gsub(content, '/usr/bin', '%%{_bindir}')
  49. content = string.gsub(content, '/usr/include', '%%{_includedir}')
  50. content = string.gsub(content, '/usr/src', '%%{_usrsrc}')
  51. content = string.gsub(content, '/usr', '%%{_prefix}')
  52. content = string.gsub(content, '/var/lib', '%%{_sharedstatedir}')
  53. content = string.gsub(content, '/run', '%%{_rundir}')
  54. content = string.gsub(content, '/var', '%%{_localstatedir}')
  55. content = string.gsub(content, '/etc', '%%{_sysconfdir}')
  56. f[i] = io.open(specname[i], 'w')
  57. f[i]:write(content)
  58. f[i]:close()
  59. end
  60. pkgbuild:close()
ダウンロード 印刷用表示

このコピペの URL

JavaScript での埋め込み

iframe での埋め込み

元のテキスト