Format scripts with shfmt

This commit is contained in:
Marko Korhonen 2024-05-09 11:02:40 +03:00
parent 7aa6142adb
commit 3599220815
Signed by: FunctionalHacker
GPG key ID: A7F78BCB859CD890
2 changed files with 66 additions and 70 deletions

View file

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
run_hook () run_hook() {
{
[ -d /dev/pts ] || mkdir -p /dev/pts [ -d /dev/pts ] || mkdir -p /dev/pts
mount -t devpts devpts /dev/pts mount -t devpts devpts /dev/pts
@ -9,8 +8,7 @@ run_hook ()
/usr/sbin/dropbear -E -s -j -k /usr/sbin/dropbear -E -s -j -k
} }
run_cleanuphook () run_cleanuphook() {
{
umount /dev/pts umount /dev/pts
rm -R /dev/pts rm -R /dev/pts
if [ -f /var/run/dropbear.pid ]; then if [ -f /var/run/dropbear.pid ]; then

View file

@ -8,8 +8,8 @@ get_fingerprint() {
display_fingerprints() { display_fingerprints() {
keyfile keyfile
for keyfile in "/etc/dropbear/dropbear_rsa_host_key" "/etc/dropbear/dropbear_ecdsa_host_key" ; do for keyfile in "/etc/dropbear/dropbear_rsa_host_key" "/etc/dropbear/dropbear_ecdsa_host_key"; do
if [ -s "${keyfile}" ] ; then if [ -s "${keyfile}" ]; then
echo "$(basename "${keyfile}") : $(get_fingerprint "${keyfile}")" echo "$(basename "${keyfile}") : $(get_fingerprint "${keyfile}")"
fi fi
done done
@ -38,7 +38,7 @@ copy_openssh_keys() {
generate_keys() { generate_keys() {
keyfile keytype keyfile keytype
for keytype in rsa ecdsa ; do for keytype in rsa ecdsa; do
keyfile="/etc/dropbear/dropbear_${keytype}_host_key" keyfile="/etc/dropbear/dropbear_${keytype}_host_key"
if [ ! -s "$keyfile" ]; then if [ ! -s "$keyfile" ]; then
echo "Generating ${keytype} host key for dropbear ..." echo "Generating ${keytype} host key for dropbear ..."
@ -47,8 +47,7 @@ generate_keys() {
done done
} }
build () build() {
{
# #
# Begin real processing # Begin real processing
# #
@ -78,7 +77,7 @@ build ()
add_binary "dropbear" add_binary "dropbear"
add_dir "/root/.ssh" add_dir "/root/.ssh"
cat /etc/dropbear/root_key > "${BUILDROOT}"/root/.ssh/authorized_keys cat /etc/dropbear/root_key >"${BUILDROOT}"/root/.ssh/authorized_keys
add_full_dir "/etc/dropbear" add_full_dir "/etc/dropbear"
add_file "/lib/libnss_files.so.2" add_file "/lib/libnss_files.so.2"
@ -89,9 +88,8 @@ build ()
add_runscript add_runscript
} }
help () help() {
{ cat <<HELPEOF
cat<<HELPEOF
This hook is meant to be used in conjunction with mkinitcpio-netconf and/or This hook is meant to be used in conjunction with mkinitcpio-netconf and/or
mkinitcpio-ppp. It DOES NOT provide any default shell. It will only install mkinitcpio-ppp. It DOES NOT provide any default shell. It will only install
and start dropbear on early userspace. In the package mkinitcpio-utils you and start dropbear on early userspace. In the package mkinitcpio-utils you