#!/bin/bash

sleep 0.5
get-devs
ports=$(lsblk -o FSTYPE)
title="$(gettext "Users and passwords:")"
user="$(gettext "User:")"
u=${#user}
password="$(gettext "Password:")"
line_1="$user 'benutzer';\t$password 'starbuntu'"
fill=$'       '
admin="Admin:$fill"; admin="${admin::$((u+2))}"
[ $LANGUAGE = "en" ] && infix="\t" || infix="\t\t"
line_2="$admin 'root';$infix$password 'buntustar'"
[ -d "/run/live" ] && notify-send -t 60000 "$title" "\n$line_1\n$line_2"

while true; do
  pts=$(lsblk -o FSTYPE)
  if [ "$pts" != "$ports" ]; then get-devs; ports=$pts; fi
  sleep 1.5  # coproc read -t 1.5 && wait "$!" || true
done
