releasename_linux_arm.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (C) 2014 The Syncthing Authors.
  2. //
  3. // This program is free software: you can redistribute it and/or modify it
  4. // under the terms of the GNU General Public License as published by the Free
  5. // Software Foundation, either version 3 of the License, or (at your option)
  6. // any later version.
  7. //
  8. // This program is distributed in the hope that it will be useful, but WITHOUT
  9. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. // more details.
  12. //
  13. // You should have received a copy of the GNU General Public License along
  14. // with this program. If not, see <http://www.gnu.org/licenses/>.
  15. package upgrade
  16. import (
  17. "fmt"
  18. "strings"
  19. "syscall"
  20. )
  21. func releaseName(tag string) string {
  22. return fmt.Sprintf("syncthing-linux-armv%s-%s.", goARM(), tag)
  23. }
  24. // Get the current ARM architecture version for upgrade purposes. If we can't
  25. // figure it out from the uname, default to ARMv6 (same as Go distribution).
  26. func goARM() string {
  27. var name syscall.Utsname
  28. syscall.Uname(&name)
  29. machine := string(name.Machine[:5])
  30. if strings.HasPrefix(machine, "armv") {
  31. return machine[4:]
  32. }
  33. return "6"
  34. }