mabox-tools/bin/mabox-obstart

42 lines
988 B
Plaintext
Raw Normal View History

2020-02-20 01:21:01 +01:00
#!/usr/bin/env bash
2020-02-18 17:24:18 +01:00
#
#
2020-02-20 01:21:01 +01:00
virtualboxes() {
if [[ -x "$(command -v VBoxManage)" ]]; then
{
printf "%b\n" "^sep(Maszyny wirtualne)"
printf "%b\n" "VirtualBox GUI,virtualbox"
}> $HOME/.config/mabox/vboxes.csv
VBoxManage list -s vms | cut -f 2 -d "\"" | sort -f | while read vm
do
printf "%s\n" "$vm,vboxmanage startvm ${vm}" >>$HOME/.config/mabox/vboxes.csv
done
printf "%s\n%s\n" "^sep()" "Odśwież listę,/usr/bin/mabox-obstart virtualboxes" >>$HOME/.config/mabox/vboxes.csv
fi
}
startopenbox() {
2020-02-18 17:24:18 +01:00
# Copy only new files from /etc/xdg/autostart/
config_dir=${XDG_CONFIG_HOME:-$HOME/.config}
rsync -aq --ignore-existing /etc/xdg/autostart/ $config_dir/autostart
# source Mabox main config file
. $HOME/.config/mabox/mabox.conf
# Run mwelcome if not disaled
2020-02-20 01:21:01 +01:00
[ $show_welcome == true ] && mwelcome &
virtualboxes
}
case "$1" in
startopenbox) startopenbox;;
virtualboxes) virtualboxes;;
*)
echo -e "Usage $(basename "$0") startopenbox|virtualboxes" >&2
exit 1
;;
esac
exit 0