Space Communication System based on CCSDS recommendations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

euryspacectl 3.1 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #!/bin/bash
  2. ################################
  3. # Project: EurySPACE CCSDS RX/TX
  4. # Design Name: euryspacectl
  5. # Version: 1.0.0
  6. # Description:
  7. # EurySPACE management tool
  8. # Validated on CentOS 7
  9. # TODO: Ubuntu 16 LTS
  10. ################################
  11. # Author(s):
  12. # Guillaume REMBERT
  13. ################################
  14. # Licence:
  15. # MIT
  16. ################################
  17. # Changes list:
  18. # 2017/09/04: initial release
  19. ################################
  20. #Conf for sources / builds
  21. #Install environment (dev / prod) + all / only sub-parts
  22. #############
  23. # FUNCTIONS #
  24. #############
  25. function show_help {
  26. echo "EurySPACE control tool"
  27. echo "Usage example:"
  28. echo "euryspacectl -a ACTION [-d DESTINATION] [-e ENVIRONMENT] [-o OPERATING_SYSTEM] [-t TARGET] [-u USER]"
  29. echo "ACTION: install"
  30. echo "DESTINATION: destination folder (default: /home/euryspace)"
  31. echo "ENVIRONMENT: dev|development, prod|production (default value)"
  32. echo "OPERATING_SYSTEM: centos7 (default value), ubuntu16"
  33. echo "TARGET: all (default value), space|space_segment, ground|ground_segment, user|user_segment"
  34. echo "USER: user used to start (default: astronaut)"
  35. }
  36. START_TIME=$(date +%s)
  37. ####################
  38. # SCRIPT VARIABLES #
  39. ####################
  40. EURYSPACE_PRODUCTION=true
  41. EURYSPACE_OPERATING_SYSTEM="centos7"
  42. EURYSPACE_USER="astronaut"
  43. #########################
  44. # SCRIPT INITIALISATION #
  45. #########################
  46. #Check script is run as root
  47. if [[ $EUID -ne 0 ]]; then
  48. echo "This script must be run as root" 1>&2
  49. exit 1
  50. fi
  51. #Get configuration variables and functions
  52. SCRIPT_COMMAND=$(readlink -f "$0")
  53. SCRIPT_PATH=$(dirname "$SCRIPT_COMMAND")
  54. #Should not be changed except if you changed sw folder layout
  55. SCRIPT_CONF_PATH=$SCRIPT_PATH/cfg/sw/euryspace.conf
  56. #Get input parameters
  57. while getopts :a:e:ht: ARGUMENT
  58. do
  59. case "${ARGUMENT}" in
  60. a) SCRIPT_ACTION=${OPTARG}
  61. case "${SCRIPT_ACTION}" in
  62. install)
  63. ;;
  64. *)
  65. echo "Unknown action: ${SCRIPT_ACTION}" 1>&2
  66. show_help
  67. exit 1
  68. ;;
  69. esac
  70. ;;
  71. d) EURYSPACE_DESTINATION=${OPTARG}
  72. ;;
  73. e) ENVIRONMENT=${OPTARG}
  74. case "${ENVIRONMENT}" in
  75. dev|development)
  76. EURYSPACE_PRODUCTION=false
  77. ;;
  78. prod|production)
  79. echo "Production environment is not yet managed" 1>&2
  80. exit 1
  81. ;;
  82. *)
  83. echo "Unknown enviroment: ${ENVIRONMENT}" 1>&2
  84. show_help
  85. exit 1
  86. esac
  87. ;;
  88. h)
  89. show_help
  90. exit 0
  91. ;;
  92. o) EURYSPACE_OPERATING_SYSTEM=${OPTARG}
  93. case "${EURYSPACE_OPERATING_SYSTEM}" in
  94. ubuntu16|centos7)
  95. ;;
  96. *)
  97. echo "Unmanaged operating system: ${EURYSPACE_OPERATING_SYSTEM}" 1>&2
  98. show_help
  99. exit 1
  100. esac
  101. ;;
  102. t) TARGET=${OPTARG}
  103. ;;
  104. u) EURYSPACE_USER=${OPTARG}
  105. ;;
  106. ?)
  107. echo "Unknown argument: ${OPTARG}" 1>&2
  108. show_help
  109. exit 1
  110. ;;
  111. esac
  112. done
  113. case "${SCRIPT_ACTION}" in
  114. install)
  115. $SCRIPT_PATH/sw/src/tools/euryspace_install.sh ${EURYSPACE_OPERATING_SYSTEM} ${EURYSPACE_PRODUCTION} ${EURYSPACE_USER} ${EURYSPACE_DESTINATION}
  116. ;;
  117. esac