Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1 from frebib/alpine
Browse files Browse the repository at this point in the history
Infer the community repo from the main repo URL

Signed-off-by: Sebastian Schmidt <[email protected]>
  • Loading branch information
publicarray committed Jul 9, 2018
2 parents ac1a6ff + 13e737a commit cda73df
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libmachine/provision/alpine.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,15 @@ func (provisioner *AlpineProvisioner) Provision(swarmOptions swarm.Options, auth
}

log.Debug("Add Community repo")
if _, err := provisioner.SSHCommand("if ! which docker >/dev/null && ! apk info docker >/dev/null; then ver=$(awk '{split($1,a,\".\"); print a[1]\".\"a[2]}' /etc/alpine-release); echo \"http://dl-cdn.alpinelinux.org/alpine/v$ver/community\" >> /etc/apk/repositories; apk update; fi"); err != nil {
if _, err := provisioner.SSHCommand(`
if ! grep -q '^[[:blank:]]*[^#].*community$' /etc/apk/repositories; then
if ! grep -q '^[[:blank:]]*[^#].*main$' /etc/apk/repositories; then
echo "http://dl-cdn.alpinelinux.org/alpine/v$(cut -d. -f1-2 /etc/alpine-release)/community" >> /etc/apk/repositories;
else
sed -i '/^\\s*[^#].*main/{p;s/main/community/;}' /etc/apk/repositories;
fi
fi;
apk update`); err != nil {
return err
}

Expand Down

0 comments on commit cda73df

Please sign in to comment.