Draft
Conversation
Contributor
|
Sorry for showing up unexpectedly. I just noticed the few things. I hope it's not too much bikeshading. I do a lot of Makefile programming and have also integrated the qubes build system in to my monorepo, and I often stumble about suboptimal Makefiles. |
DemiMarie
reviewed
Nov 24, 2021
| local name="$1" | ||
| local hypervisor | ||
|
|
||
| if [[ $(cat /sys/hypervisor/type 2>/dev/null) == 'xen' ]]; then |
Contributor
There was a problem hiding this comment.
Suggested change
| if [[ $(cat /sys/hypervisor/type 2>/dev/null) == 'xen' ]]; then | |
| if hypervisor=$(cat /sys/hypervisor/type 2>/dev/null) && [[ "$hypervisor" = 'xen' ]]; then |
| echo "$hypervisor" | ||
| return 0 | ||
| fi | ||
| if [ "$name" == "$hypervisor" ]; then |
Contributor
There was a problem hiding this comment.
Suggested change
| if [ "$name" == "$hypervisor" ]; then | |
| if [ "$name" = "$hypervisor" ]; then |
| @@ -1,14 +1,21 @@ | |||
| #!/bin/sh | |||
| #!/usr/bin/sh | |||
Contributor
There was a problem hiding this comment.
Suggested change
| #!/usr/bin/sh | |
| #!/usr/bin/bash -- | |
| set -euo pipefail |
| #### KVM: | ||
| if hypervisor xen; then | ||
| /usr/lib/qubes/fix-dir-perms.sh | ||
| DOM0_MAXMEM=$(/usr/sbin/xl list 0 | tail -1 | awk '{ print $3 }') |
Contributor
There was a problem hiding this comment.
This runs into an xl bug: xl doesn’t check for write errors on stdout. The following helps but does not fix the problem:
Suggested change
| DOM0_MAXMEM=$(/usr/sbin/xl list 0 | tail -1 | awk '{ print $3 }') | |
| DOM0_MAXMEM=$(/usr/sbin/xl list 0 | awk 'NR == 1 && NF > 3 && $3 ~ /^[0-9]+$/ { print $3 }') |
| if hypervisor xen; then | ||
| /usr/lib/qubes/fix-dir-perms.sh | ||
| DOM0_MAXMEM=$(/usr/sbin/xl list 0 | tail -1 | awk '{ print $3 }') | ||
| xenstore-write /local/domain/0/memory/static-max $[ $DOM0_MAXMEM * 1024 ] |
Contributor
There was a problem hiding this comment.
Suggested change
| xenstore-write /local/domain/0/memory/static-max $[ $DOM0_MAXMEM * 1024 ] | |
| xenstore-write /local/domain/0/memory/static-max "$(( $DOM0_MAXMEM * 1024 ))" |
| fi | ||
| ######## | ||
|
|
||
| cp /var/lib/qubes/qubes.xml /var/lib/qubes/backup/qubes-$(date +%F-%T).xml |
Contributor
There was a problem hiding this comment.
Suggested change
| cp /var/lib/qubes/qubes.xml /var/lib/qubes/backup/qubes-$(date +%F-%T).xml | |
| s=$(date +%F-%T) && cp /var/lib/qubes/qubes.xml "/var/lib/qubes/backup/qubes-$s.xml" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
QubesOS/qubes-issues#7051