Skip to content

Commit 4221113

Browse files
lukeseawalkerrexcsn
authored andcommitted
Run apt update non-interactively
Assume "yes" as answer to apt update prompts and run non-interactively. If an undesirable situation occurs, such as changing a held package or removing an essential package, then command will still abort. This solves aws/aws-parallelcluster#2401 Please notice the difference between `apt-get update -y` and `apt update -y`: The former will return without actually answering yes, hence failing. The latter will answer yes to the prompt ``` $ sudo apt-get update -y Reading package lists... Done E: Repository 'https://fsx-lustre-client-repo.s3.amazonaws.com/ubuntu bionic InRelease' changed its 'Origin' value from '' to 'AWS-FSx-for-Lustre' E: Repository 'https://fsx-lustre-client-repo.s3.amazonaws.com/ubuntu bionic InRelease' changed its 'Suite' value from '' to 'stable' N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details. $ echo $? 100 ``` ``` $ sudo apt update -y E: Repository 'https://fsx-lustre-client-repo.s3.amazonaws.com/ubuntu bionic InRelease' changed its 'Origin' value from '' to 'AWS-FSx-for-Lustre' E: Repository 'https://fsx-lustre-client-repo.s3.amazonaws.com/ubuntu bionic InRelease' changed its 'Suite' value from '' to 'stable' N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details. Do you want to accept these changes and continue updating from this repository? [y/N] Y Get:6 https://fsx-lustre-client-repo.s3.amazonaws.com/ubuntu bionic/main amd64 Packages [8389 B] Fetched 11.7 kB in 1s (15.8 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done 31 packages can be upgraded. Run 'apt list --upgradable' to see them. ``` Signed-off-by: Luca Carrogu <[email protected]>
1 parent da75abe commit 4221113

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

amis/packer_ubuntu1604.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
"inline" : [
174174
"sudo apt-cache search build-essential",
175175
"sudo apt-get clean",
176-
"sudo apt-get update"
176+
"sudo apt update -y"
177177
]
178178
},
179179
{

amis/packer_ubuntu1804.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
"inline" : [
175175
"sudo apt-cache search build-essential",
176176
"sudo apt-get clean",
177-
"sudo apt-get update"
177+
"sudo apt update -y"
178178
]
179179
},
180180
{

0 commit comments

Comments
 (0)