Sweets / hummingbird

Hummingbird init system for Linux based operating systems.
MIT License
247 stars 7 forks source link

makefile: Support DESTDIR, rc.init: Fix redirections and white-space, Plus other fixes. #3

Closed dylanaraps closed 5 years ago

dylanaraps commented 5 years ago

This allows package managers (xbps-src, makepkg, puke) to install hummingbird to a "fake" root. It also allows for installing to a chroot.

Example:

make DESTDIR=~/.chroot install

The result is ~/.chroot/usr/bin/hummingbird etc.

dylanaraps commented 5 years ago

I forgot to create a new branch. My bad.

Second commit fixes re-directions of stdout and stderr to /dev/null as well as trailing white-space.

dylanaraps commented 5 years ago

Will send more commits later.

dylanaraps commented 5 years ago

You can use type to check if a command exists. It's a shell builtin and you can avoid the subshell.

dylanaraps commented 5 years ago

I've replaced the basename = basename test with ${var##*/} = ${var2##*/}. This avoids two subshells and two external calls to basename.

dylanaraps commented 5 years ago

Question:

Can the eval call be removed here?:

eval "$command 115200,38400,9600 tty${index} linux"

Would "$command" "115200,38400,9600" "tty${index}" "linux" not work?

Sweets commented 5 years ago

There was a reason I used eval, but honestly I don’t even remember why it’s been so long. So natural selection dictates eval be killed off.

Sweets commented 5 years ago

All ready to merge?

dylanaraps commented 5 years ago

:+1: