This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
home-manager/horsch/zsh.nix

62 lines
1.4 KiB
Nix
Raw Normal View History

2024-07-10 06:10:56 +00:00
{ ... }:
{
2024-07-10 11:06:26 +00:00
programs.zsh.initExtra = ''
if [ -f $HOME/.nix-profile/etc/profile.d/nix.sh ];
2024-07-10 11:40:41 +00:00
then
source $HOME/.nix-profile/etc/profile.d/nix.sh
2024-07-10 11:06:26 +00:00
fi
function sc-log {
ssh smartcan "SYSTEMD_COLORS=true journalctl --follow --no-tail --unit smartcan-''${1:-*}"
}
function sc-restart {
ssh smartcan "systemctl restart smartcan-''${1}"
}
function fu-build {
./kas-container build kas/kas-ttc-image-horsch.yml
}
2024-09-03 07:17:24 +00:00
function fu-build-dev {
./kas-container build kas/kas-ttc-image-horsch-dev.yml
}
2024-07-10 11:06:26 +00:00
function fu-reboot {
ssh fusion "reboot"
}
function fu-flash {
local ssh_login="fusion"
local update_file=''${1}
if [ -z ''${update_file} ]; then
update_file=$(find build/tmp/deploy/images -name "*.swu" -type f | fzf --select-1)
2024-07-10 11:40:41 +00:00
fi
2024-07-10 11:06:26 +00:00
if [ -z ''${update_file} ]; then
2024-07-10 11:40:41 +00:00
echo "no file selected"
return 1
2024-07-10 06:10:56 +00:00
fi
2024-07-10 11:06:26 +00:00
if [ ! -f ''${update_file} ]; then
2024-07-10 11:40:41 +00:00
echo "file \"''${update_file}\" does not exist"
return 2
2024-07-10 11:06:26 +00:00
fi
2024-07-10 06:10:56 +00:00
2024-07-10 11:06:26 +00:00
echo "flashing ''${update_file} to device..."
cat "''${update_file}" | ssh ''${ssh_login} "swupdate-client -"
2024-07-10 06:10:56 +00:00
2024-07-10 11:06:26 +00:00
if [ $? -ne 0 ]; then
echo "update failed"
return 3
fi
2024-07-10 06:10:56 +00:00
2024-07-10 11:06:26 +00:00
echo "rebooting device"
ssh ''${ssh_login} reboot
2024-07-10 06:10:56 +00:00
2024-07-10 11:06:26 +00:00
echo "done."
}
'';
2024-07-10 06:10:56 +00:00
}