Skip to content

Commit e48c2ff

Browse files
authored
Merge pull request #107 from microsoft/copilot/change-os-detection-to-package-manager
Replace OS detection with package manager detection in install scripts
2 parents 28922f7 + 183c6f3 commit e48c2ff

File tree

8 files changed

+10
-22
lines changed

8 files changed

+10
-22
lines changed

src/artifacts-helper/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Azure Artifacts Credential Helper",
33
"id": "artifacts-helper",
4-
"version": "3.0.5",
4+
"version": "3.0.6",
55
"description": "Configures Codespace to authenticate with Azure Artifact feeds",
66
"options": {
77
"nugetURIPrefixes": {

src/artifacts-helper/install.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ if [ "${ALIAS_AZ}" = "true" ]; then
4444
ALIASES_ARR+=('az')
4545
fi
4646

47-
# Source /etc/os-release to get OS info
48-
. /etc/os-release
49-
5047
if [ "$(id -u)" -ne 0 ]; then
5148
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
5249
exit 1
@@ -70,7 +67,7 @@ check_packages() {
7067

7168
export DEBIAN_FRONTEND=noninteractive
7269

73-
if [ "${ID}" = "mariner" ]; then
70+
if command -v tdnf >/dev/null 2>&1; then
7471
tdnf install -y wget ca-certificates
7572
tdnf clean all
7673
else

src/devtool/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "DevTool",
33
"id": "devtool",
4-
"version": "1.0.3",
4+
"version": "1.0.4",
55
"description": "Install DevTool",
66
"installsAfter": [
77
"ghcr.io/devcontainers/features/common-utils"

src/devtool/install.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
set -e
44

55

6-
# Source /etc/os-release to get OS info
7-
. /etc/os-release
8-
96
if [ "$(id -u)" -ne 0 ]; then
107
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
118
exit 1
@@ -30,7 +27,7 @@ check_packages() {
3027

3128
export DEBIAN_FRONTEND=noninteractive
3229

33-
if [ "${ID}" = "mariner" ]; then
30+
if command -v tdnf >/dev/null 2>&1; then
3431
tdnf install -y curl ca-certificates tar
3532
tdnf clean all
3633
else

src/go/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "go",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"name": "Go",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/go",
66
"description": "Installs Go and common Go utilities. Auto-detects latest version and installs needed dependencies.",

src/go/install.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ INSTALL_GO_TOOLS="${INSTALL_GO_TOOLS:-"true"}"
1919
GO_GPG_KEY_URI="https://dl.google.com/linux/linux_signing_key.pub"
2020

2121
set -e
22-
# Source /etc/os-release to get OS info
23-
. /etc/os-release
2422

2523
if [ "$(id -u)" -ne 0 ]; then
2624
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
@@ -116,7 +114,7 @@ check_packages() {
116114

117115
export DEBIAN_FRONTEND=noninteractive
118116

119-
if [ "${ID}" = "mariner" ]; then
117+
if command -v tdnf >/dev/null 2>&1; then
120118
tdnf install -y curl ca-certificates gnupg2 tar g++ gcc make git build-essential
121119
else
122120
# Clean up
@@ -252,7 +250,7 @@ find "${TARGET_GOROOT}" -type d -print0 | xargs -n 1 -0 chmod g+s
252250
find "${TARGET_GOPATH}" -type d -print0 | xargs -n 1 -0 chmod g+s
253251

254252
# Clean up
255-
if [ "${ID}" = "mariner" ]; then
253+
if command -v tdnf >/dev/null 2>&1; then
256254
tdnf clean all
257255
else
258256
rm -rf /var/lib/apt/lists/*

src/microsoft-git/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Microsoft Git for monorepo with GVFS support",
33
"id": "microsoft-git",
4-
"version": "1.0.8",
4+
"version": "1.0.9",
55
"description": "A fork of Git containing Microsoft-specific patches",
66
"options": {
77
"version": {

src/microsoft-git/install.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ GIT_VERSION=${VERSION:-"latest"}
99

1010
set -e
1111

12-
# Source /etc/os-release to get OS info
13-
. /etc/os-release
14-
1512
if [ "$(id -u)" -ne 0 ]; then
1613
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
1714
exit 1
@@ -35,7 +32,7 @@ check_packages() {
3532

3633
export DEBIAN_FRONTEND=noninteractive
3734

38-
if [ "${ID}" = "mariner" ]; then
35+
if command -v tdnf >/dev/null 2>&1; then
3936
tdnf install -y curl ca-certificates
4037
else
4138
check_packages curl ca-certificates
@@ -67,8 +64,7 @@ fi
6764

6865
echo "Downloading Microsoft Git ${GIT_VERSION}..."
6966

70-
# If ID is mariner
71-
if [ "${ID}" = "mariner" ]; then
67+
if command -v tdnf >/dev/null 2>&1; then
7268
# We need to build Git from source release on Mariner
7369
tdnf install -y wget tar git pcre2 binutils build-essential openssl-devel expat-devel curl-devel python3-devel gettext asciidoc xmlto cronie
7470
wget -q https://github.com/microsoft/git/archive/refs/tags/v${GIT_VERSION}.tar.gz

0 commit comments

Comments
 (0)