man_rebrand.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #!/bin/sh
  2. #########################
  3. # Name: man_rebrand.sh
  4. # Main: jadedctrl
  5. # Lisc: ISC
  6. # Desc: Rebranding OBSD man
  7. # pages for use in
  8. # LBSD.
  9. #########################
  10. # Usage: man_rebrand.sh $SRC_DIR
  11. # Often: man_rebrand.sh /usr/src/share/man
  12. . ./libdeblob.sh
  13. PATCH_DIR=/tmp/man_rebrand
  14. if [ -e "$PATCH_DIR" ]
  15. then
  16. self_destruct_sequence "$PATCH_DIR"
  17. mkdir "$PATCH_DIR"
  18. else
  19. mkdir "$PATCH_DIR"
  20. fi
  21. if test -z "$1"
  22. then
  23. SRC_DIR=/usr/src
  24. else
  25. SRC_DIR="$1"
  26. fi
  27. ox_replace() {
  28. local file rfile
  29. for file in "$SRC_DIR/$1"/*
  30. do
  31. if echo "$file" | grep -q "\.[1-9]$"
  32. then
  33. rfile="${file#$SRC_DIR/}"
  34. if grep -q ".Ox \." "$file"
  35. then
  36. rep ".Ox \." "LibertyBSD\." "$rfile"
  37. fi
  38. if grep -q ".Ox \," "$file"
  39. then
  40. rep ".Ox \," "LibertyBSD\," "$rfile"
  41. fi
  42. if grep -q ".Ox \:" "$file"
  43. then
  44. rep ".Ox \:" "LibertyBSD\:" "$rfile"
  45. fi
  46. if grep -q ".Ox$" "$file"
  47. then
  48. rep ".Ox$" "LibertyBSD" "$rfile"
  49. fi
  50. if grep -q "ftp.openbsd.org" "$file"
  51. then
  52. rep "ftp.openbsd.org" "ftp.libertybsd.net" "$rfile"
  53. fi
  54. if grep -q "http://openbsd.org" "$file"
  55. then
  56. rep "http://libertybsd.net" "$rfile"
  57. fi
  58. if grep -q "https://openbsd.org" "$file"
  59. then
  60. rep "https://libertybsd.net" "$rfile"
  61. fi
  62. fi
  63. done
  64. }
  65. mandirectories="man0 man1 man3 man4 man5 man6 man7 man8 man9"
  66. for mandir in $mandirectories
  67. do
  68. ox_replace "share/man/$mandir"
  69. done
  70. bindirectories="bin sbin usr.bin usr.sbin"
  71. for bindir in $bindirectories
  72. do
  73. for dir in "$SRC_DIR/$bindir"/*
  74. do
  75. if [ -d "$dir" ]
  76. then
  77. fixdir="${dir#$SRC_DIR/}"
  78. ox_replace "$fixdir"
  79. fi
  80. done
  81. done
  82. filecp files/man/release.8 share/man/man8/release.8
  83. filecp files/man/help.1 share/man/man1/help.1
  84. # Add Free Software-related man pages
  85. filecp files/man/fsdg.7 share/man/man7/fsdg.7
  86. filecp files/man/free-software.7 share/man/man7/free-software.7
  87. rep "environ.7 glob.7 hier.7 hostname.7 intro.7 kgdb.7 " \
  88. "environ.7 free-software.7 fsdg.7 glob.7 hier.7 " share/man/man7/Makefile
  89. rep "library-specs.7 mailaddr.7" \
  90. "hostname.7 intro.7 kgdb.7 library-specs.7 mailaddr.7" \
  91. share/man/man7/Makefile
  92. lineadd "./usr/share/man/man7/eqn.7" "./usr/share/man/man7/fsdg.7" \
  93. distrib/sets/lists/man/mi
  94. lineadd "./usr/share/man/man7/eqn.7" "./usr/share/man/man7/free-software.7" \
  95. distrib/sets/lists/man/mi
  96. rep "eqn.7 " "eqn.7" distrib/sets/lists/man/mi
  97. rep "free-software.7 " "free-software.7" distrib/sets/lists/man/mi
  98. apply