Skip to content

Commit da5a1a6

Browse files
authored
Update 'installpsh-suse.sh' and remove 'download.sh' (PowerShell#5309)
- Update `installpsh-suse.sh` to work with the .tar.gz binary archive. - Remove `download.sh` as it's not used anywhere now. (checked with PowerShellGet and OneGet, they are using a local copy of download.sh).
1 parent c9f83fe commit da5a1a6

8 files changed

Lines changed: 49 additions & 173 deletions

File tree

.spelling

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,6 @@ u
406406
- demos/DSC/readme.md
407407
#endregion
408408

409-
#region demos/install/README.md Overrides
410-
- demos/install/README.md
411-
download.sh
412-
#endregion
413-
414409
#region demos/python/README.md Overrides
415410
- demos/python/README.md
416411
_script.ps1

demos/install/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
## Install demo
1+
# Install demo
22

3-
For Windows refer to the [installation instructions](https://github.com/PowerShell/PowerShell/blob/master/docs/installation/windows.md)
3+
For Windows refer to the [installation instructions](https://github.com/PowerShell/PowerShell/blob/master/docs/installation/windows.md).
44

5-
For Linux, using [download.sh](https://github.com/PowerShell/PowerShell/blob/master/tools/download.sh) is the best way to deploy PowerShell bits
5+
For Linux, using [`install-powershell.sh`](https://github.com/PowerShell/PowerShell/blob/master/tools/install-powershell-readme.md) is the best way to deploy PowerShell bits.

docs/building/linux.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Installing the toolchain is as easy as running `Start-PSBootstrap` in PowerShell
2525
Of course, this requires a self-hosted copy of PowerShell on Linux.
2626

2727
Fortunately, this is as easy as [downloading and installing the package](../installation/linux.md).
28-
The `./tools/download.sh` script will also install the PowerShell package.
28+
The `./tools/install-powershell.sh` script will also install the PowerShell package.
2929

3030
In Bash:
3131

tools/download.sh

Lines changed: 0 additions & 151 deletions
This file was deleted.

tools/installpsh-debian.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ $SUDO apt-get update
132132
# Install PowerShell
133133
$SUDO apt-get install -y powershell
134134

135-
pwsh -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME"'
135+
pwsh -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME.
136+
Run `"pwsh`" to start a PowerShell session."'
137+
136138
success=$?
137139

138140
if [[ "$success" != 0 ]]; then

tools/installpsh-osx.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ if [[ "'$*'" =~ includeide ]] ; then
165165
code --install-extension ms-vscode.PowerShell
166166
fi
167167

168-
pwsh -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME"'
168+
pwsh -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME.
169+
Run `"pwsh`" to start a PowerShell session."'
170+
169171
success=$?
170172

171173
if [[ "$success" != 0 ]]; then

tools/installpsh-redhat.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ echo "*** Setting up PowerShell Core repo..."
129129
$SUDO curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/microsoft.repo
130130
$SUDO yum install -y powershell
131131

132-
pwsh -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME"'
132+
pwsh -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME.
133+
Run `"pwsh`" to start a PowerShell session."'
134+
133135
success=$?
134136

135137
if [[ "$success" != 0 ]]; then

tools/installpsh-suse.sh

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ VERSION="1.1.2"
2222
gitreposubpath="PowerShell/PowerShell/master"
2323
gitreposcriptroot="https://raw.githubusercontent.com/$gitreposubpath/tools"
2424
thisinstallerdistro=suse
25-
repobased=true
25+
repobased=false
2626
gitscriptname="installpsh-suse.psh"
2727

2828
echo
@@ -116,15 +116,22 @@ fi
116116

117117
#END Verify The Installer Choice
118118

119+
echo
120+
echo "*** Installing prerequisites for PowerShell Core..."
121+
$SUDO zypper --non-interactive install \
122+
glibc-locale \
123+
glibc-i18ndata \
124+
tar \
125+
curl \
126+
libunwind \
127+
libicu \
128+
openssl \
129+
&& zypper --non-interactive clean --all
119130

120131
##END Check requirements and prerequisites
121132

122133
echo
123134
echo "*** Installing PowerShell Core for $DistroBasedOn..."
124-
if ! hash curl 2>/dev/null; then
125-
echo "curl not found, installing..."
126-
$SUDO zypper install -y curl
127-
fi
128135
release=`curl https://api.github.com/repos/powershell/powershell/releases/latest | sed '/tag_name/!d' | sed s/\"tag_name\"://g | sed s/\"//g | sed s/v//g | sed s/,//g | sed s/\ //g`
129136

130137
#REPO BASED (Not ready yet)
@@ -140,8 +147,8 @@ release=`curl https://api.github.com/repos/powershell/powershell/releases/latest
140147
#$SUDO zypper --non-interactive install powershell
141148

142149
#DIRECT DOWNLOAD
143-
packagerel=`echo $release | sed 's/-/_/'`
144-
package=powershell-${packagerel}-1.suse.42.1.x86_64.rpm
150+
pwshlink=/usr/bin/pwsh
151+
package=powershell-${release}-linux-x64.tar.gz
145152
downloadurl=https://github.com/PowerShell/PowerShell/releases/download/v$release/$package
146153

147154
echo "Destination file: $package"
@@ -154,10 +161,29 @@ if [[ ! -r "$package" ]]; then
154161
exit 1
155162
fi
156163

157-
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
158-
sudo zypper --non-interactive install "./$package"
164+
## Create the target folder where powershell will be placed
165+
$SUDO mkdir -p /opt/microsoft/powershell/$release
166+
## Expand powershell to the target folder
167+
$SUDO tar zxf $package -C /opt/microsoft/powershell/$release
168+
169+
## Change the mode of 'pwsh' to 'rwxr-xr-x' to allow execution
170+
$SUDO chmod 755 /opt/microsoft/powershell/$release/pwsh
171+
## Create the symbolic link that points to powershell
172+
$SUDO ln -s /opt/microsoft/powershell/$release/pwsh $pwshlink
173+
174+
## Add the symbolic link path to /etc/shells
175+
if [ ! -f /etc/shells ] ; then
176+
echo $pwshlink | $SUDO tee /etc/shells ;
177+
else
178+
grep -q "^${pwshlink}$" /etc/shells || echo $pwshlink | $SUDO tee --append /etc/shells > /dev/null ;
179+
fi
180+
181+
## Remove the downloaded package file
182+
rm -f $package
183+
184+
pwsh -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME.
185+
Run `"pwsh`" to start a PowerShell session."'
159186

160-
powershell -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME"'
161187
success=$?
162188

163189
if [[ "$success" != 0 ]]; then

0 commit comments

Comments
 (0)