diff --git a/api/protoc.sh b/api/protoc.sh index c2be2e2..28adfe4 100755 --- a/api/protoc.sh +++ b/api/protoc.sh @@ -7,6 +7,10 @@ gen_protoc() { "$1"/"$2" } -for api in admin systemd wifi hwid locale; do - gen_protoc api/$api $api.proto +if [ $# -eq 0 ]; then + set -- admin hwid locale systemd wifi +fi + +for protob in "$@"; do + gen_protoc api/"$protob" "$protob".proto done diff --git a/api/systemd/systemd.pb.go b/api/systemd/systemd.pb.go index e606890..10d01a4 100644 --- a/api/systemd/systemd.pb.go +++ b/api/systemd/systemd.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v4.24.4 +// protoc-gen-go v1.34.2 +// protoc v4.25.4 // source: systemd.proto package systemd @@ -177,12 +177,13 @@ type UnitStatus struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` - Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty"` - LoadState string `protobuf:"bytes,3,opt,name=LoadState,proto3" json:"LoadState,omitempty"` - ActiveState string `protobuf:"bytes,4,opt,name=ActiveState,proto3" json:"ActiveState,omitempty"` - SubState string `protobuf:"bytes,5,opt,name=SubState,proto3" json:"SubState,omitempty"` - Path string `protobuf:"bytes,6,opt,name=Path,proto3" json:"Path,omitempty"` + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty"` + LoadState string `protobuf:"bytes,3,opt,name=LoadState,proto3" json:"LoadState,omitempty"` + ActiveState string `protobuf:"bytes,4,opt,name=ActiveState,proto3" json:"ActiveState,omitempty"` + SubState string `protobuf:"bytes,5,opt,name=SubState,proto3" json:"SubState,omitempty"` + Path string `protobuf:"bytes,6,opt,name=Path,proto3" json:"Path,omitempty"` + FreezerState string `protobuf:"bytes,7,opt,name=FreezerState,proto3" json:"FreezerState,omitempty"` } func (x *UnitStatus) Reset() { @@ -259,6 +260,13 @@ func (x *UnitStatus) GetPath() string { return "" } +func (x *UnitStatus) GetFreezerState() string { + if x != nil { + return x.FreezerState + } + return "" +} + type UnitStatusResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -430,7 +438,7 @@ var file_systemd_proto_rawDesc = []byte{ 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x41, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x41, - 0x72, 0x67, 0x73, 0x22, 0xb2, 0x01, 0x0a, 0x0a, 0x55, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, + 0x72, 0x67, 0x73, 0x22, 0xd6, 0x01, 0x0a, 0x0a, 0x55, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x44, 0x65, 0x73, @@ -441,57 +449,60 @@ var file_systemd_proto_rawDesc = []byte{ 0x69, 0x76, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x75, 0x62, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x53, 0x75, 0x62, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x50, 0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x50, 0x61, 0x74, 0x68, 0x22, 0x67, 0x0a, 0x12, 0x55, 0x6e, 0x69, 0x74, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x43, 0x6d, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x43, 0x6d, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x33, 0x0a, 0x0a, - 0x55, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x13, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0a, 0x55, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x22, 0x31, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x74, - 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x74, - 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x54, 0x0a, 0x14, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x43, 0x70, 0x75, 0x55, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, - 0x43, 0x70, 0x75, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, - 0x72, 0x79, 0x55, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0b, 0x4d, - 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x55, 0x73, 0x61, 0x67, 0x65, 0x32, 0x9e, 0x04, 0x0a, 0x12, 0x55, - 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x55, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, - 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x09, 0x53, 0x74, 0x61, 0x72, 0x74, - 0x55, 0x6e, 0x69, 0x74, 0x12, 0x14, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, - 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x79, 0x73, - 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x08, 0x53, 0x74, 0x6f, 0x70, 0x55, 0x6e, 0x69, 0x74, 0x12, - 0x14, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, - 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x39, - 0x0a, 0x08, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x14, 0x2e, 0x73, 0x79, 0x73, + 0x28, 0x09, 0x52, 0x04, 0x50, 0x61, 0x74, 0x68, 0x12, 0x22, 0x0a, 0x0c, 0x46, 0x72, 0x65, 0x65, + 0x7a, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x46, 0x72, 0x65, 0x65, 0x7a, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x67, 0x0a, 0x12, + 0x55, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x6d, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x43, 0x6d, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x12, 0x33, 0x0a, 0x0a, 0x55, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, + 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0a, 0x55, 0x6e, 0x69, 0x74, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x31, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, + 0x55, 0x6e, 0x69, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x55, 0x6e, 0x69, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x54, 0x0a, 0x14, 0x55, 0x6e, 0x69, 0x74, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x70, 0x75, 0x55, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x08, 0x43, 0x70, 0x75, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x20, 0x0a, 0x0b, + 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x55, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x02, 0x52, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x55, 0x73, 0x61, 0x67, 0x65, 0x32, 0x9e, + 0x04, 0x0a, 0x12, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x55, 0x6e, 0x69, 0x74, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, + 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x73, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x09, 0x53, + 0x74, 0x61, 0x72, 0x74, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x14, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, + 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x08, 0x53, 0x74, 0x6f, 0x70, 0x55, + 0x6e, 0x69, 0x74, 0x12, 0x14, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, + 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x39, 0x0a, 0x08, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x14, + 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, + 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, + 0x0a, 0x46, 0x72, 0x65, 0x65, 0x7a, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x14, 0x2e, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0c, 0x55, 0x6e, + 0x66, 0x72, 0x65, 0x65, 0x7a, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x14, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x0a, 0x46, 0x72, 0x65, - 0x65, 0x7a, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x14, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, - 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, - 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0c, 0x55, 0x6e, 0x66, 0x72, 0x65, 0x65, - 0x7a, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x14, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, - 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, - 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0b, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, - 0x55, 0x6e, 0x69, 0x74, 0x12, 0x1c, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, - 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, - 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x72, 0x74, 0x41, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x2e, 0x73, 0x79, 0x73, 0x74, - 0x65, 0x6d, 0x64, 0x2e, 0x41, 0x70, 0x70, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0b, 0x5a, 0x09, 0x2e, - 0x2f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0b, 0x4d, 0x6f, 0x6e, + 0x69, 0x74, 0x6f, 0x72, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x1c, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x64, 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, + 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x10, 0x53, 0x74, 0x61, + 0x72, 0x74, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x2e, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x2e, 0x41, 0x70, 0x70, 0x55, 0x6e, 0x69, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, + 0x2e, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, + 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -507,7 +518,7 @@ func file_systemd_proto_rawDescGZIP() []byte { } var file_systemd_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_systemd_proto_goTypes = []interface{}{ +var file_systemd_proto_goTypes = []any{ (*UnitRequest)(nil), // 0: systemd.UnitRequest (*UnitResponse)(nil), // 1: systemd.UnitResponse (*AppUnitRequest)(nil), // 2: systemd.AppUnitRequest @@ -547,7 +558,7 @@ func file_systemd_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_systemd_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_systemd_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*UnitRequest); i { case 0: return &v.state @@ -559,7 +570,7 @@ func file_systemd_proto_init() { return nil } } - file_systemd_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_systemd_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*UnitResponse); i { case 0: return &v.state @@ -571,7 +582,7 @@ func file_systemd_proto_init() { return nil } } - file_systemd_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_systemd_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*AppUnitRequest); i { case 0: return &v.state @@ -583,7 +594,7 @@ func file_systemd_proto_init() { return nil } } - file_systemd_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_systemd_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*UnitStatus); i { case 0: return &v.state @@ -595,7 +606,7 @@ func file_systemd_proto_init() { return nil } } - file_systemd_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_systemd_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*UnitStatusResponse); i { case 0: return &v.state @@ -607,7 +618,7 @@ func file_systemd_proto_init() { return nil } } - file_systemd_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_systemd_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*UnitResourceRequest); i { case 0: return &v.state @@ -619,7 +630,7 @@ func file_systemd_proto_init() { return nil } } - file_systemd_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_systemd_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*UnitResourceResponse); i { case 0: return &v.state diff --git a/api/systemd/systemd.proto b/api/systemd/systemd.proto index 718f56a..e2cd605 100644 --- a/api/systemd/systemd.proto +++ b/api/systemd/systemd.proto @@ -24,6 +24,7 @@ message UnitStatus { string ActiveState = 4; string SubState = 5; string Path = 6; + string FreezerState = 7; } message UnitStatusResponse { diff --git a/api/systemd/systemd_grpc.pb.go b/api/systemd/systemd_grpc.pb.go index ef30f63..60fea3f 100644 --- a/api/systemd/systemd_grpc.pb.go +++ b/api/systemd/systemd_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 +// - protoc v4.25.4 // source: systemd.proto package systemd diff --git a/devshell.nix b/devshell.nix index 7bb2304..629662a 100644 --- a/devshell.nix +++ b/devshell.nix @@ -43,9 +43,9 @@ help = "update git pre-commit hooks"; } { - help = "Generate go files from protobuffers"; + help = "Generate go files from protobuffers. Examples: '$ protogen systemd'"; name = "protogen"; - command = "./api/protoc.sh"; + command = "./api/protoc.sh $@"; } { help = "Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers"; diff --git a/internal/pkgs/serviceclient/transport.go b/internal/pkgs/serviceclient/transport.go index 958923d..b47e5b1 100644 --- a/internal/pkgs/serviceclient/transport.go +++ b/internal/pkgs/serviceclient/transport.go @@ -43,12 +43,13 @@ func GetRemoteStatus(cfg *types.EndpointConfig, unitName string) (*types.UnitSta } response := &types.UnitStatus{ - Name: resp.UnitStatus.Name, - Description: resp.UnitStatus.Description, - LoadState: resp.UnitStatus.LoadState, - ActiveState: resp.UnitStatus.ActiveState, - SubState: resp.UnitStatus.SubState, - Path: string(resp.UnitStatus.Path), + Name: resp.UnitStatus.Name, + Description: resp.UnitStatus.Description, + LoadState: resp.UnitStatus.LoadState, + ActiveState: resp.UnitStatus.ActiveState, + SubState: resp.UnitStatus.SubState, + Path: string(resp.UnitStatus.Path), + FreezerState: resp.UnitStatus.FreezerState, } return response, nil diff --git a/internal/pkgs/servicemanager/controller.go b/internal/pkgs/servicemanager/controller.go index 856caf4..df01f62 100644 --- a/internal/pkgs/servicemanager/controller.go +++ b/internal/pkgs/servicemanager/controller.go @@ -329,6 +329,29 @@ func (c *SystemdController) GetUnitProperties(ctx context.Context, unitName stri return props, nil } +func (c *SystemdController) GetUnitPropertyString(ctx context.Context, unitName string, propertyName string) (string, error) { + + // Input validation + if ctx == nil { + return "", fmt.Errorf("context cannot be nil") + } + if unitName == "" { + return "", fmt.Errorf("incorrect input, must be unit name") + } + if propertyName == "" { + return "", fmt.Errorf("incorrect input, must be property name") + } + + // Get unit properties + prop, err := c.conn.GetUnitPropertyContext(ctx, unitName, propertyName) + if err != nil { + return "", err + } + + propString := strings.Trim(prop.Value.String(), "\"") + return propString, nil +} + func (c *SystemdController) StartApplication(ctx context.Context, serviceName string, serviceArgs []string) (string, error) { cmdFailure := "Command failed." diff --git a/internal/pkgs/servicemanager/transport.go b/internal/pkgs/servicemanager/transport.go index ddf742d..59ea4c7 100644 --- a/internal/pkgs/servicemanager/transport.go +++ b/internal/pkgs/servicemanager/transport.go @@ -66,15 +66,22 @@ func (s *SystemdControlServer) GetUnitStatus(ctx context.Context, req *systemd_a return nil, grpc_status.Error(grpc_codes.NotFound, errStr) } + freezerState, err := s.Controller.GetUnitPropertyString(context.Background(), req.UnitName, "FreezerState") + if err != nil { + log.Infof("[GetUnitStatus] Error fetching freezer state: %v\n", err) + freezerState = "error" + } + resp := &systemd_api.UnitStatusResponse{ CmdStatus: "Command successful", UnitStatus: &systemd_api.UnitStatus{ - Name: unitStatus[0].Name, - Description: unitStatus[0].Description, - LoadState: unitStatus[0].LoadState, - ActiveState: unitStatus[0].ActiveState, - SubState: unitStatus[0].SubState, - Path: string(unitStatus[0].Path), + Name: unitStatus[0].Name, + Description: unitStatus[0].Description, + LoadState: unitStatus[0].LoadState, + ActiveState: unitStatus[0].ActiveState, + SubState: unitStatus[0].SubState, + Path: string(unitStatus[0].Path), + FreezerState: freezerState, }, } diff --git a/internal/pkgs/types/types.go b/internal/pkgs/types/types.go index 86411c0..976e57f 100644 --- a/internal/pkgs/types/types.go +++ b/internal/pkgs/types/types.go @@ -37,12 +37,13 @@ const ( ) type UnitStatus struct { - Name string - Description string - LoadState string - ActiveState string - SubState string - Path string + Name string + Description string + LoadState string + ActiveState string + SubState string + Path string + FreezerState string } type TransportConfig struct {