diff options
author | Aaron Ball <nullspoon@oper.io> | 2017-02-04 20:03:53 -0700 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2017-02-04 20:03:53 -0700 |
commit | 422145765b0eea6ccde695c4d82a18370e02c712 (patch) | |
tree | 0765787e29ac6956c1e466cb958b19269b074a97 | |
parent | b90d32757dd219c82e187fe247c28c97f6d58cfe (diff) | |
parent | 70176ad2c847fdcf76e00de1eb438e6c5f2a6165 (diff) | |
download | mkinitramfs-422145765b0eea6ccde695c4d82a18370e02c712.tar.gz mkinitramfs-422145765b0eea6ccde695c4d82a18370e02c712.tar.xz |
Merge branch 'mkinit-install'
-rwxr-xr-x | mkinitramfs | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/mkinitramfs b/mkinitramfs index 4c738bb..d7d3d61 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -126,27 +126,7 @@ function cache_dir_setup { # Clean the cache so we start fresh rm -rf ${cache} && mkdir ${cache} - local dirs=( - bin - dev - dev/disk - dev/disk/by-uuid - etc - lib - lib32 - lib64 - mnt/root - proc - root - run - sbin - sys - usr/lib - usr/lib64 - usr/lib32 - usr/bin - usr/sbin - ) + local dirs=(bin dev etc lib lib32 lib64 mnt/root proc root run sbin sys usr) # Create the temporary directory structure for i in ${dirs[*]}; do @@ -209,7 +189,7 @@ function main { # List of binaries to exist in the new initramfs resolve_bins \ bash cat echo ls cryptsetup chmod chown mount sleep umount clear cut \ - grep less tr which blkid shutdown switch_root + grep less tr which blkid reboot shutdown switch_root # Set up the archive source dir. @@ -220,28 +200,22 @@ function main { # Copy binary and dependencies to cache dir for bin in ${fqbins[@]}; do - bindirname=$(dirname ${bin}) # Copy the binary of interest - cp -u ${bin} "${cache}/${bindirname}/" + install -D "${bin}" "${cache}/${bin}" - deps=$(get_deps ${bin}) + local deps=$(get_deps ${bin}) # Copy each of the binary's deps for dep in ${deps[@]}; do - local depdirname=$(dirname ${dep}) - cp -u ${dep} "${cache}/${depdirname}/" - if [[ $? -gt 0 ]]; then - echo "Error: Problem copying ${dep} into ${cache}." - exit 1 - fi + install -D ${dep} "${cache}/${dep}" done done - # Copy in init script and add execute - cp ${res_path}/init ${cache}/init && chmod +x ${cache}/init # Copy in message file - cp ${res_path}/msg ${cache}/etc/msg + [[ -f ${res_path}/msg ]] && install -D ${res_path}/msg ${cache}/etc/msg + # Copy in init script and add execute + install -D -m 755 ${res_path}/init ${cache}/init # Copy in the system shell profile - cp /etc/profile ${cache}/etc/profile + install -D /etc/profile ${cache}/etc/profile # Create archive image mkcpio ${cache} ${version} |