Merge pull request #235473 from szlend/fix-deterministic-uname-getops

authored by

Artturi and committed by
GitHub
9acebc35 a9648759

+17 -18
+17 -18
pkgs/build-support/deterministic-uname/deterministic-uname.sh
··· 38 38 hardware_platform=0 39 39 operating_system=0 40 40 41 + # With no OPTION, same as -s. 42 + if [[ $# -eq 0 ]]; then 43 + kernel_name=1 44 + fi 41 45 42 46 @getopt@/bin/getopt --test > /dev/null && rc=$? || rc=$? 43 47 if [[ $rc -ne 4 ]]; then ··· 52 56 PARSED=`@getopt@/bin/getopt --options $SHORT --longoptions $LONG --name "$0" -- "$@"` 53 57 54 58 eval set -- "$PARSED" 55 - fi 56 - 57 - # With no OPTION, same as -s. 58 - if [[ $# -eq 0 ]]; then 59 - kernel_name=1 60 59 fi 61 60 62 61 # Process each argument, and set the appropriate flag if we recognize it. ··· 132 131 # Darwin *nodename* 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:14:30 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8103 arm64 arm Darwin 133 132 # NixOS: 134 133 # Linux *nodename* 6.0.13 #1-NixOS SMP PREEMPT_DYNAMIC Wed Dec 14 10:41:06 UTC 2022 x86_64 GNU/Linux 134 + output=() 135 135 if [[ "$all" = "1" ]]; then 136 - echo -n "$KERNEL_NAME_VAL $NODENAME_VAL $KERNEL_RELEASE_VAL $KERNEL_VERSION_VAL $MACHINE_VAL " 136 + output+=("$KERNEL_NAME_VAL" "$NODENAME_VAL" "$KERNEL_RELEASE_VAL" "$KERNEL_VERSION_VAL" "$MACHINE_VAL") 137 137 # in help: except omit -p and -i if unknown. 138 - #echo -n "$PROCESSOR_VAL $HARDWARE_PLATFORM_VAL\n" 139 - echo -n "$OPERATING_SYSTEM_VAL" 138 + # output+=($PROCESSOR_VAL $HARDWARE_PLATFORM_VAL) 139 + output+=("$OPERATING_SYSTEM_VAL") 140 140 fi 141 141 142 142 if [[ "$kernel_name" = "1" ]]; then 143 - echo -n "$KERNEL_NAME_VAL" 143 + output+=("$KERNEL_NAME_VAL") 144 144 fi 145 145 146 146 if [[ "$nodename" = "1" ]]; then 147 - echo -n "$NODENAME_VAL" 147 + output+=("$NODENAME_VAL") 148 148 fi 149 149 150 150 if [[ "$kernel_release" = "1" ]]; then 151 - echo -n "$KERNEL_RELEASE_VAL" 151 + output+=("$KERNEL_RELEASE_VAL") 152 152 fi 153 153 154 154 if [[ "$kernel_version" = "1" ]]; then 155 - echo -n "$KERNEL_VERSION_VAL" 155 + output+=("$KERNEL_VERSION_VAL") 156 156 fi 157 157 158 158 if [[ "$machine" = "1" ]]; then 159 - echo -n "$MACHINE_VAL" 159 + output+=("$MACHINE_VAL") 160 160 fi 161 161 162 162 if [[ "$processor" = "1" ]]; then 163 - echo -n "$PROCESSOR_VAL" 163 + output+=("$PROCESSOR_VAL") 164 164 fi 165 165 166 166 if [[ "$hardware_platform" = "1" ]]; then 167 - echo -n "$HARDWARE_PLATFORM_VAL" 167 + output+=("$HARDWARE_PLATFORM_VAL") 168 168 fi 169 169 170 170 if [[ "$operating_system" = "1" ]]; then 171 - echo -n "$OPERATING_SYSTEM_VAL" 171 + output+=("$OPERATING_SYSTEM_VAL") 172 172 fi 173 173 174 - # for newline. 175 - echo 174 + echo "${output[@]}"