make-mkinitcpio-fhs-compliant.patch 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. diff --git a/Makefile b/Makefile
  2. index 4b4abba..7d6671e 100644
  3. --- a/Makefile
  4. +++ b/Makefile
  5. @@ -3,15 +3,15 @@
  6. VERSION = $(shell if test -f VERSION; then cat VERSION; else git describe | sed 's/-/./g;s/^v//;'; fi)
  7. DIRS = \
  8. - /usr/bin \
  9. + /sbin \
  10. /usr/share/bash-completion/completions \
  11. /usr/share/zsh/site-functions \
  12. /etc/mkinitcpio.d \
  13. /etc/initcpio/hooks \
  14. /etc/initcpio/install \
  15. - /usr/lib/initcpio/hooks \
  16. - /usr/lib/initcpio/install \
  17. - /usr/lib/initcpio/udev \
  18. + /lib/initcpio/hooks \
  19. + /lib/initcpio/install \
  20. + /lib/initcpio/udev \
  21. /usr/share/man/man8 \
  22. /usr/share/man/man5 \
  23. /usr/share/man/man1 \
  24. @@ -32,25 +32,25 @@ install: all
  25. install -dm755 $(addprefix $(DESTDIR),$(DIRS))
  26. sed -e 's|\(^_f_config\)=.*|\1=/etc/mkinitcpio.conf|' \
  27. - -e 's|\(^_f_functions\)=.*|\1=/usr/lib/initcpio/functions|' \
  28. - -e 's|\(^_d_hooks\)=.*|\1=/etc/initcpio/hooks:/usr/lib/initcpio/hooks|' \
  29. - -e 's|\(^_d_install\)=.*|\1=/etc/initcpio/install:/usr/lib/initcpio/install|' \
  30. + -e 's|\(^_f_functions\)=.*|\1=/lib/initcpio/functions|' \
  31. + -e 's|\(^_d_hooks\)=.*|\1=/etc/initcpio/hooks:/lib/initcpio/hooks|' \
  32. + -e 's|\(^_d_install\)=.*|\1=/etc/initcpio/install:/lib/initcpio/install|' \
  33. -e 's|\(^_d_presets\)=.*|\1=/etc/mkinitcpio.d|' \
  34. -e 's|%VERSION%|$(VERSION)|g' \
  35. - < mkinitcpio > $(DESTDIR)/usr/bin/mkinitcpio
  36. + < mkinitcpio > $(DESTDIR)/sbin/mkinitcpio
  37. - sed -e 's|\(^_f_functions\)=.*|\1=/usr/lib/initcpio/functions|' \
  38. + sed -e 's|\(^_f_functions\)=.*|\1=/lib/initcpio/functions|' \
  39. -e 's|%VERSION%|$(VERSION)|g' \
  40. - < lsinitcpio > $(DESTDIR)/usr/bin/lsinitcpio
  41. + < lsinitcpio > $(DESTDIR)/sbin/lsinitcpio
  42. - chmod 755 $(DESTDIR)/usr/bin/lsinitcpio $(DESTDIR)/usr/bin/mkinitcpio
  43. + chmod 755 $(DESTDIR)/sbin/lsinitcpio $(DESTDIR)/sbin/mkinitcpio
  44. install -m644 mkinitcpio.conf $(DESTDIR)/etc/mkinitcpio.conf
  45. - install -m755 -t $(DESTDIR)/usr/lib/initcpio init shutdown
  46. - install -m644 -t $(DESTDIR)/usr/lib/initcpio init_functions functions
  47. - install -m644 udev/01-memdisk.rules $(DESTDIR)/usr/lib/initcpio/udev/01-memdisk.rules
  48. + install -m755 -t $(DESTDIR)/lib/initcpio init shutdown
  49. + install -m644 -t $(DESTDIR)/lib/initcpio init_functions functions
  50. + install -m644 udev/01-memdisk.rules $(DESTDIR)/lib/initcpio/udev/01-memdisk.rules
  51. - cp -at $(DESTDIR)/usr/lib/initcpio hooks install
  52. + cp -at $(DESTDIR)/lib/initcpio hooks install
  53. install -m644 -t $(DESTDIR)/usr/share/mkinitcpio mkinitcpio.d/*
  54. install -m644 man/mkinitcpio.8 $(DESTDIR)/usr/share/man/man8/mkinitcpio.8
  55. diff --git a/functions b/functions
  56. index 4afc902..0fab375 100644
  57. --- a/functions
  58. +++ b/functions
  59. @@ -651,19 +651,12 @@ initialize_buildroot() {
  60. fi
  61. # base directory structure
  62. - install -dm755 "$buildroot"/{new_root,proc,sys,dev,run,tmp,etc,usr/{local,lib,bin}}
  63. - ln -s "usr/lib" "$buildroot/lib"
  64. - ln -s "../lib" "$buildroot/usr/local/lib"
  65. - ln -s "bin" "$buildroot/usr/sbin"
  66. - ln -s "usr/bin" "$buildroot/bin"
  67. - ln -s "usr/bin" "$buildroot/sbin"
  68. - ln -s "../bin" "$buildroot/usr/local/bin"
  69. - ln -s "../bin" "$buildroot/usr/local/sbin"
  70. + install -dm755 "$buildroot"/{new_root,proc,sys,dev,run,tmp,etc,usr/{local/{lib,{,s}bin},lib,{,s}bin},lib,{,s}bin}
  71. case $arch in
  72. x86_64)
  73. - ln -s "lib" "$buildroot/usr/lib64"
  74. - ln -s "usr/lib" "$buildroot/lib64"
  75. + ln -s "lib" "$buildroot/usr/lib64"
  76. + ln -s "lib" "$buildroot/lib64"
  77. ;;
  78. esac
  79. @@ -671,7 +664,7 @@ initialize_buildroot() {
  80. printf '%s' "$version" >"$buildroot/VERSION"
  81. # kernel module dir
  82. - [[ $kernver != none ]] && install -dm755 "$buildroot/usr/lib/modules/$kernver/kernel"
  83. + [[ $kernver != none ]] && install -dm755 "$buildroot/lib/modules/$kernver/kernel"
  84. # mount tables
  85. ln -s /proc/self/mounts "$buildroot/etc/mtab"
  86. diff --git a/hooks/consolefont b/hooks/consolefont
  87. index 118a10d..81f48ec 100644
  88. --- a/hooks/consolefont
  89. +++ b/hooks/consolefont
  90. @@ -1,4 +1,4 @@
  91. -#!/usr/bin/ash
  92. +#!/bin/ash
  93. run_hook() {
  94. if [ -e /consolefont.psfu ]; then
  95. diff --git a/hooks/keymap b/hooks/keymap
  96. index a5ae9d0..05cadb8 100644
  97. --- a/hooks/keymap
  98. +++ b/hooks/keymap
  99. @@ -1,4 +1,4 @@
  100. -#!/usr/bin/ash
  101. +#!/bin/ash
  102. run_hook() {
  103. if [ -e /keymap.bin ]; then
  104. diff --git b/hooks/lib b/hooks/lib
  105. new file mode 100644
  106. index 0000000..95cda53
  107. --- /dev/null
  108. +++ b/hooks/lib
  109. @@ -0,0 +1,22 @@
  110. +#!/bin/ash
  111. +
  112. +run_latehook() {
  113. + local lib_source mountopts passno realtab=/new_root/etc/fstab
  114. +
  115. + if [ -f "$realtab" ]; then
  116. + if lib_source=$(findmnt -snero source --tab-file="$realtab" -T /lib); then
  117. + mountopts=$(findmnt -snero options --tab-file="$realtab" -T /lib)
  118. +
  119. + # returning the passno column requires util-linux >= 2.23. for
  120. + # older versions which do not support this column, always fsck.
  121. + passno=$(findmnt -snero passno --tab-file="$realtab" -T /lib 2>/dev/null)
  122. + if [ -z "$passno" ] || [ "$passno" -gt 0 ]; then
  123. + fsck_device "$lib_source"
  124. + fi
  125. + msg ":: mounting '$lib_source' on /lib"
  126. + mount "$lib_source" /new_root/lib -o "$mountopts"
  127. + fi
  128. + fi
  129. +}
  130. +
  131. +# vim: set ft=sh ts=4 sw=4 et:
  132. diff --git a/hooks/memdisk b/hooks/memdisk
  133. index 62790b4..6e9ab4d 100644
  134. --- a/hooks/memdisk
  135. +++ b/hooks/memdisk
  136. @@ -1,4 +1,4 @@
  137. -#!/usr/bin/ash
  138. +#!/bin/ash
  139. run_hook() {
  140. local disk
  141. diff --git a/hooks/resume b/hooks/resume
  142. index 04ca1aa..9addd89 100644
  143. --- a/hooks/resume
  144. +++ b/hooks/resume
  145. @@ -1,4 +1,4 @@
  146. -#!/usr/bin/ash
  147. +#!/bin/ash
  148. run_hook () {
  149. local resumedev
  150. diff --git a/hooks/shutdown b/hooks/shutdown
  151. index ce64caf..5c16ea0 100644
  152. --- a/hooks/shutdown
  153. +++ b/hooks/shutdown
  154. @@ -1,7 +1,7 @@
  155. -#!/usr/bin/ash
  156. +#!/bin/ash
  157. run_cleanuphook() {
  158. - rm -rf /usr/lib/modules
  159. + rm -rf /lib/modules
  160. cp -ax / /run/initramfs
  161. }
  162. diff --git a/hooks/sleep b/hooks/sleep
  163. index 72fc503..73fcb16 100644
  164. --- a/hooks/sleep
  165. +++ b/hooks/sleep
  166. @@ -1,4 +1,4 @@
  167. -#!/usr/bin/ash
  168. +#!/bin/ash
  169. run_hook() {
  170. if [ -z "${sleeptime}" ] || ! [ "${sleeptime}" -gt 0 ]; then
  171. diff --git a/hooks/usr a/hooks/usr
  172. deleted file mode 100644
  173. index 44aebb2..0000000
  174. --- a/hooks/usr
  175. +++ /dev/null
  176. @@ -1,22 +0,0 @@
  177. -#!/usr/bin/ash
  178. -
  179. -run_latehook() {
  180. - local usr_source mountopts passno realtab=/new_root/etc/fstab
  181. -
  182. - if [ -f "$realtab" ]; then
  183. - if usr_source=$(findmnt -snero source --tab-file="$realtab" -T /usr); then
  184. - mountopts=$(findmnt -snero options --tab-file="$realtab" -T /usr)
  185. -
  186. - # returning the passno column requires util-linux >= 2.23. for
  187. - # older versions which do not support this column, always fsck.
  188. - passno=$(findmnt -snero passno --tab-file="$realtab" -T /usr 2>/dev/null)
  189. - if [ -z "$passno" ] || [ "$passno" -gt 0 ]; then
  190. - fsck_device "$usr_source"
  191. - fi
  192. - msg ":: mounting '$usr_source' on /usr"
  193. - mount "$usr_source" /new_root/usr -o "$mountopts"
  194. - fi
  195. - fi
  196. -}
  197. -
  198. -# vim: set ft=sh ts=4 sw=4 et:
  199. diff --git a/init b/init
  200. index 2cb3526..2fae5a7 100644
  201. --- a/init
  202. +++ b/init
  203. @@ -1,4 +1,4 @@
  204. -#!/usr/bin/ash
  205. +#!/bin/ash
  206. udevd_running=0
  207. mount_handler=default_mount_handler
  208. @@ -73,6 +73,6 @@ rdlogger_stop
  209. exec env -i \
  210. "TERM=$TERM" \
  211. - /usr/bin/switch_root /new_root $init "$@"
  212. + /sbin/switch_root /new_root $init "$@"
  213. # vim: set ft=sh ts=4 sw=4 et:
  214. diff --git a/install/autodetect b/install/autodetect
  215. index 846aa3a..fecc7f3 100644
  216. --- a/install/autodetect
  217. +++ b/install/autodetect
  218. @@ -37,9 +37,9 @@ build() {
  219. fs_autodetect_failed=1
  220. fi
  221. - # detect filesystem for separate /usr
  222. - if usrfstype=$(findmnt -snero fstype -T '/usr'); then
  223. - add_if_avail "$usrfstype"
  224. + # detect filesystem for separate /lib
  225. + if libfstype=$(findmnt -snero fstype -T '/lib'); then
  226. + add_if_avail "$libfstype"
  227. fi
  228. # scan for md raid devices
  229. diff --git a/install/base b/install/base
  230. index 0d3954f..41f136e 100644
  231. --- a/install/base
  232. +++ b/install/base
  233. @@ -3,24 +3,41 @@
  234. build() {
  235. local applet
  236. - add_binary /usr/lib/initcpio/busybox /bin/busybox
  237. + add_binary /lib/initcpio/busybox /bin/busybox
  238. - for applet in $(/usr/lib/initcpio/busybox --list); do
  239. - add_symlink "/usr/bin/$applet" busybox
  240. + for applet in ash cat chgrp chmod chown cp dd df dmesg echo egrep false grep ip ipaddr iplink iproute iprule \
  241. + kbd_mode kill less ln ls mkdir mknod mktemp mountpoint mv netstat openvt ping ping6 ps pwd \
  242. + readlink rm rmdir sed setfont sh sleep sync touch true umount uname vi; do
  243. + add_symlink "/bin/$applet" busybox
  244. + done
  245. +
  246. + for applet in blkdiscard fstrim halt ifconfig init iptunnel losetup poweroff reboot route; do
  247. + add_symlink "/sbin/$applet" ../bin/busybox
  248. + done
  249. +
  250. + for applet in \[ \[\[ awk basename clear cttyhack cut dirname du env expr fatattr free getopt head hexdump \
  251. + install killall loadfont loadkmap md5sum mkfifo mkpasswd nc nsenter nslookup pgrep pidof printf \
  252. + seq sha1sum sha256sum sha512sum shuf sort stat strings tac tail telnet test tftp truncate uniq \
  253. + unlink unshare uptime wc wget yes; do
  254. + add_symlink "/usr/bin/$applet" ../../bin/busybox
  255. + done
  256. +
  257. + for applet in chroot; do
  258. + add_symlink "/usr/sbin/$applet" ../../bin/busybox
  259. done
  260. # add kmod with applet symlinks
  261. add_binary kmod
  262. for applet in {dep,ins,rm,ls}mod mod{probe,info}; do
  263. - add_symlink "/usr/bin/$applet" kmod
  264. + add_symlink "/sbin/$applet" ../bin/kmod
  265. done
  266. add_binary blkid
  267. add_binary mount
  268. add_binary switch_root
  269. - add_file "/usr/lib/initcpio/init_functions" "/init_functions"
  270. - add_file "/usr/lib/initcpio/init" "/init"
  271. + add_file "/lib/initcpio/init_functions" "/init_functions"
  272. + add_file "/lib/initcpio/init" "/init"
  273. }
  274. help() {
  275. diff --git a/install/fsck b/install/fsck
  276. index d20750e..4321740 100644
  277. --- a/install/fsck
  278. +++ b/install/fsck
  279. @@ -6,22 +6,22 @@ build() {
  280. add_fsck() {
  281. if [[ $1 = ext[234] ]]; then
  282. add_binary fsck.ext4
  283. - add_symlink /usr/bin/fsck.ext2 fsck.ext4
  284. - add_symlink /usr/bin/fsck.ext3 fsck.ext4
  285. + add_symlink /sbin/fsck.ext2 fsck.ext4
  286. + add_symlink /sbin/fsck.ext3 fsck.ext4
  287. else
  288. add_binary "fsck.$1"
  289. fi
  290. }
  291. - if (( ! fs_autodetect_failed )) && [[ $rootfstype$usrfstype ]]; then
  292. + if (( ! fs_autodetect_failed )) && [[ $rootfstype$libfstype ]]; then
  293. if [[ $rootfstype ]]; then
  294. add_fsck $rootfstype && (( ++added ))
  295. fi
  296. - if [[ $usrfstype && $usrfstype != $rootfstype ]]; then
  297. - add_fsck $usrfstype && (( ++added ))
  298. + if [[ $libfstype && $libfstype != $rootfstype ]]; then
  299. + add_fsck $libfstype && (( ++added ))
  300. fi
  301. else
  302. - for fsck in /usr/bin/fsck.*; do
  303. + for fsck in /sbin/fsck.*; do
  304. [[ -f $fsck ]] || continue
  305. add_binary "$fsck" && (( ++added ))
  306. done
  307. diff --git b/install/lib b/install/lib
  308. new file mode 100644
  309. index 0000000..5805a64
  310. --- /dev/null
  311. +++ b/install/lib
  312. @@ -0,0 +1,16 @@
  313. +#!/bin/bash
  314. +
  315. +build() {
  316. + add_binary findmnt
  317. + add_runscript
  318. +}
  319. +
  320. +help() {
  321. + cat <<HELPEOF
  322. +This provides a support for mounting /lib via a late running hook. No
  323. +configuration is needed, as the mount options will be pulled directly from the
  324. +fstab on the real root device.
  325. +HELPEOF
  326. +}
  327. +
  328. +# vim: set ft=sh ts=4 sw=4 et:
  329. diff --git a/install/memdisk b/install/memdisk
  330. index 9b3577d..b3f0bfe 100644
  331. --- a/install/memdisk
  332. +++ b/install/memdisk
  333. @@ -4,7 +4,7 @@ build() {
  334. add_module 'phram'
  335. add_module 'mtdblock'
  336. - add_file /usr/lib/initcpio/udev/01-memdisk.rules /lib/udev/rules.d/01-memdisk.rules
  337. + add_file /lib/initcpio/udev/01-memdisk.rules /lib/udev/rules.d/01-memdisk.rules
  338. add_binary "memdiskfind"
  339. add_runscript
  340. diff --git a/install/modconf b/install/modconf
  341. index 06cb997..f2bcadc 100644
  342. --- a/install/modconf
  343. +++ b/install/modconf
  344. @@ -2,13 +2,13 @@
  345. build() {
  346. add_full_dir /etc/modprobe.d '*.conf'
  347. - add_full_dir /usr/lib/modprobe.d '*.conf'
  348. + add_full_dir /lib/modprobe.d '*.conf'
  349. }
  350. help() {
  351. cat <<HELPEOF
  352. This hook installs modprobe configuration files from /etc/modprobe.d and
  353. -/usr/lib/modprobe.d.
  354. +/lib/modprobe.d.
  355. HELPEOF
  356. }
  357. diff --git a/install/shutdown b/install/shutdown
  358. index 1de2f1f..e570d15 100644
  359. --- a/install/shutdown
  360. +++ b/install/shutdown
  361. @@ -5,7 +5,7 @@ build() {
  362. add_binary lsblk
  363. add_binary findmnt
  364. add_binary umount
  365. - add_file "/usr/lib/initcpio/shutdown" "/shutdown" 755
  366. + add_file "/lib/initcpio/shutdown" "/shutdown" 755
  367. add_runscript
  368. }
  369. @@ -13,7 +13,7 @@ build() {
  370. help() {
  371. cat <<HELPEOF
  372. This hook copies the contents of the initramfs into /run/initramfs for reuse
  373. -on shutdown. This is needed when you have /usr mounted on a separate partition.
  374. +on shutdown. This is needed when you have /lib mounted on a separate partition.
  375. HELPEOF
  376. }
  377. diff --git a/install/usr a/install/usr
  378. deleted file mode 100644
  379. index cdd3ca6..0000000
  380. --- a/install/usr
  381. +++ /dev/null
  382. @@ -1,16 +0,0 @@
  383. -#!/bin/bash
  384. -
  385. -build() {
  386. - add_binary findmnt
  387. - add_runscript
  388. -}
  389. -
  390. -help() {
  391. - cat <<HELPEOF
  392. -This provides a support for mounting /usr via a late running hook. No
  393. -configuration is needed, as the mount options will be pulled directly from the
  394. -fstab on the real root device.
  395. -HELPEOF
  396. -}
  397. -
  398. -# vim: set ft=sh ts=4 sw=4 et:
  399. diff --git a/lsinitcpio b/lsinitcpio
  400. index 7be0649..f57cf70 100755
  401. --- a/lsinitcpio
  402. +++ b/lsinitcpio
  403. @@ -163,11 +163,11 @@ analyze_image() {
  404. decomp "$_image" | bsdtar -C "$workdir" -xf - || die 'Failed to decompress image'
  405. # collect stats
  406. - kernver=("$workdir"/usr/lib/modules/*/)
  407. + kernver=("$workdir"/lib/modules/*/)
  408. kernver=${kernver%/}
  409. kernver=${kernver##*/}
  410. - modules=("$workdir/usr/lib/modules/$kernver"/kernel/*.ko*)
  411. + modules=("$workdir/lib/modules/$kernver"/kernel/*.ko*)
  412. if [[ -f ${modules[0]} ]]; then
  413. modules=("${modules[@]##*/}")
  414. modules=("${modules[@]%.ko*}")
  415. @@ -178,7 +178,7 @@ analyze_image() {
  416. foundhooks=("$workdir"/hooks/*)
  417. [[ -f ${foundhooks[0]} ]] && foundhooks=("${foundhooks[@]##*/}") || unset foundhooks
  418. - mapfile -t binaries < <(find "$workdir/usr/bin" -type f -printf %f\\n)
  419. + mapfile -t binaries < <(find "$workdir/"{,usr/}{,s}bin -type f -printf %f\\n)
  420. read -r version < "$workdir/VERSION"
  421. diff --git a/man/mkinitcpio.8 b/man/mkinitcpio.8
  422. index 41dd7b7..7e573c4 100644
  423. --- a/man/mkinitcpio.8
  424. +++ b/man/mkinitcpio.8
  425. @@ -383,12 +383,12 @@ Default configuration file for mkinitcpio\&.
  426. Directory containing mkinitcpio presets\&.
  427. .RE
  428. .PP
  429. -\fI/etc/initcpio/install\fR, \fI/usr/lib/initcpio/install\fR
  430. +\fI/etc/initcpio/install\fR, \fI/lib/initcpio/install\fR
  431. .RS 4
  432. Search path for build time hooks\&.
  433. .RE
  434. .PP
  435. -\fI/etc/initcpio/hooks\fR, \fI/usr/lib/initcpio/hooks\fR
  436. +\fI/etc/initcpio/hooks\fR, \fI/lib/initcpio/hooks\fR
  437. .RS 4
  438. Search path for early userspace runtime hooks\&.
  439. .RE
  440. diff --git a/man/mkinitcpio.8.txt b/man/mkinitcpio.8.txt
  441. index 5c3118e..2b2dcdc 100644
  442. --- a/man/mkinitcpio.8.txt
  443. +++ b/man/mkinitcpio.8.txt
  444. @@ -305,11 +305,11 @@ Files
  445. Directory containing mkinitcpio presets.
  446. '/etc/initcpio/install'::
  447. -'/usr/lib/initcpio/install'::
  448. +'/lib/initcpio/install'::
  449. Search path for build time hooks.
  450. '/etc/initcpio/hooks'::
  451. -'/usr/lib/initcpio/hooks'::
  452. +'/lib/initcpio/hooks'::
  453. Search path for early userspace runtime hooks.
  454. Examples
  455. diff --git a/mkinitcpio b/mkinitcpio
  456. index df011df..251cf2c 100755
  457. --- a/mkinitcpio
  458. +++ b/mkinitcpio
  459. @@ -12,9 +12,9 @@ shopt -s extglob
  460. # needed files/directories
  461. _f_functions=functions
  462. _f_config=mkinitcpio.conf
  463. -_d_hooks="$PWD/hooks:/usr/lib/initcpio/hooks:/lib/initcpio/hooks"
  464. -_d_install="$PWD/install:/usr/lib/initcpio/install:/lib/initcpio/install"
  465. -_d_firmware=({/usr,}/lib/firmware/updates {/usr,}/lib/firmware)
  466. +_d_hooks="$PWD/hooks:/lib/initcpio/hooks"
  467. +_d_install="$PWD/install:/lib/initcpio/install"
  468. +_d_firmware=(/lib/firmware/updates /lib/firmware)
  469. _d_presets=mkinitcpio.d
  470. # options and runtime data
  471. diff --git a/mkinitcpio.conf b/mkinitcpio.conf
  472. index c4d5e06..050cb92 100644
  473. --- a/mkinitcpio.conf
  474. +++ b/mkinitcpio.conf
  475. @@ -47,8 +47,8 @@ FILES=""
  476. ## This setup loads an lvm2 volume group on a usb device.
  477. # HOOKS="base udev block lvm2 filesystems"
  478. #
  479. -## NOTE: If you have /usr on a separate partition, you MUST include the
  480. -# usr, fsck and shutdown hooks.
  481. +## NOTE: If you have /lib on a separate partition, you MUST include the
  482. +# lib, fsck and shutdown hooks.
  483. HOOKS="base udev autodetect modconf block filesystems keyboard fsck"
  484. # COMPRESSION
  485. diff --git a/shell/bash-completion b/shell/bash-completion
  486. index a0f07dc..c99ac42 100644
  487. --- a/shell/bash-completion
  488. +++ b/shell/bash-completion
  489. @@ -72,7 +72,7 @@ _mkinitcpio() {
  490. -p|--preset)
  491. COMPREPLY=($(compgen -W "$(_files_from_dirs -s .preset /etc/mkinitcpio.d)" -- "$cur")) ;;
  492. -[AHS]|--add|--hookhelp|--skiphooks)
  493. - COMPREPLY=($(compgen -W "$(_files_from_dirs {/usr,}/lib/initcpio/install)" -- "$cur")) ;;
  494. + COMPREPLY=($(compgen -W "$(_files_from_dirs /lib/initcpio/install)" -- "$cur")) ;;
  495. *)
  496. COMPREPLY=($(compgen -W "${opts[*]}" -- "$cur")) ;;
  497. esac
  498. diff --git a/shell/zsh-completion b/shell/zsh-completion
  499. index 4d1e435..2cdb19f 100644
  500. --- a/shell/zsh-completion
  501. +++ b/shell/zsh-completion
  502. @@ -37,10 +37,10 @@ case $service in
  503. ;;
  504. mkinitcpio)
  505. _arguments : \
  506. - '(-A --addhooks)'{-A,--addhooks}'[Add specified hooks, comma separated, to image]::usr hooks:_path_files -W /usr/lib/initcpio/install::lib hooks:_path_files -W /lib/initcpio/install' \
  507. + '(-A --addhooks)'{-A,--addhooks}'[Add specified hooks, comma separated, to image]::lib hooks:_path_files -W /lib/initcpio/install::lib hooks:_path_files -W /lib/initcpio/install' \
  508. '(-c --config)'{-c,--config}'[Use alternate config file. (default: /etc/mkinitcpio.conf)]:config files:_files' \
  509. '(-g --generate)'{-g,--generate}'[Generate cpio image and write to specified path]:config files:_files' \
  510. - '(-H --hookhelp)'{-H,--hookhelp}'[Display help for given hook and exit]::usr hooks:_path_files -W /usr/lib/initcpio/install::lib hooks:_path_files -W /lib/initcpio/install' \
  511. + '(-H --hookhelp)'{-H,--hookhelp}'[Display help for given hook and exit]::lib hooks:_path_files -W /lib/initcpio/install::lib hooks:_path_files -W /lib/initcpio/install' \
  512. '(-h --help)'{-h,--help}'[Display this message and exit]' \
  513. '(-k --kernel)'{-k,--kernel}'[Use specified kernel version]:kernel versions:_find_kernel_versions' \
  514. '(-L --listhooks)'{-L,--listhooks}'[List all available hooks]' \
  515. @@ -48,7 +48,7 @@ case $service in
  516. '(-n --nocolor)'{-n,--nocolor}'[Disable colorized output messages]' \
  517. '(-p --preset)'{-p,--preset}'[Build specified preset from /etc/mkinitcpio.d]:presets:_files -g "*(\:r)" -W /etc/mkinitcpio.d' \
  518. '(-r --moduleroot)'{-r,--moduleroot}'[Root directory for modules (default: /)]:directories:_files -/' \
  519. - '(-S --skiphooks)'{-S,--skiphooks}'[Skip specified hooks, comma-separated, during build]::usr hooks:_path_files -W /usr/lib/initcpio/install::lib hooks:_path_files -W /lib/initcpio/install' \
  520. + '(-S --skiphooks)'{-S,--skiphooks}'[Skip specified hooks, comma-separated, during build]::lib hooks:_path_files -W /lib/initcpio/install::lib hooks:_path_files -W /lib/initcpio/install' \
  521. '(-s --save)'{-s,--save}'[Save build directory. (default: no)]' \
  522. '(-t --builddir)'{-t,--builddir}'[Use DIR as the temporary build directory]:directories:_files -/' \
  523. '(-V --version)'{-V,--version}'[Display version information and exit]' \
  524. diff --git a/shutdown b/shutdown
  525. index 1f5fdc1..6d7dcdf 100644
  526. --- a/shutdown
  527. +++ b/shutdown
  528. @@ -1,4 +1,4 @@
  529. -#!/usr/bin/ash
  530. +#!/bin/ash
  531. # teardown a single device by node name
  532. # $1: device node name, e.g. md0, dm-2
  533. @@ -58,7 +58,7 @@ copy_binary_from_host() {
  534. # hardcode a sane PATH
  535. for p in '/usr/sbin' '/usr/bin' '/sbin' '/bin'; do
  536. if [ -e "/oldroot/$p/$bin" ]; then
  537. - cp "/oldroot/$p/$bin" "/usr/bin/$1"
  538. + cp "/oldroot/$p/$bin" "$p/$1"
  539. return 0
  540. fi
  541. done