]> ruderich.org/simon Gitweb - safcm/safcm.git/blob - remote/sync/services.go
Use SPDX license identifiers
[safcm/safcm.git] / remote / sync / services.go
1 // MsgSyncReq: enable and start services on the remote host
2
3 // SPDX-License-Identifier: GPL-3.0-or-later
4 // Copyright (C) 2021-2024  Simon Ruderich
5
6 package sync
7
8 import (
9         "fmt"
10         "path/filepath"
11 )
12
13 func (s *Sync) syncServices() error {
14         if len(s.req.Services) == 0 {
15                 return nil
16         }
17
18         x, err := filepath.EvalSymlinks("/sbin/init")
19         if err != nil {
20                 return err
21         }
22         if filepath.Base(x) == "systemd" {
23                 return s.syncServicesSystemd()
24         }
25         // TODO: support more distributions
26         return fmt.Errorf("not yet supported on this distribution")
27 }