Skip to content

Commit 683c5c0

Browse files
committed
Improve setup script for for ArchLinux
1 parent eca7eba commit 683c5c0

3 files changed

Lines changed: 15 additions & 16 deletions

File tree

1k/1kiss.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ function setup_nasm() {
11671167
$1k.addpath($nasm_bin)
11681168
}
11691169
elseif ($IsLinux) {
1170-
if ($(which dpkg)) {
1170+
if (Get-Command dpkg -ErrorAction SilentlyContinue) {
11711171
sudo apt-get install -y nasm
11721172
}
11731173
}
@@ -1215,10 +1215,10 @@ function setup_unzip() {
12151215
$unzip_cmd_info = Get-Command 'unzip' -ErrorAction SilentlyContinue
12161216
if (!$unzip_cmd_info) {
12171217
if ($IsLinux) {
1218-
if ($(which dpkg)) {
1218+
if (Get-Command dpkg -ErrorAction SilentlyContinue) {
12191219
sudo apt-get install -y unzip
12201220
}
1221-
elseif ($(which pacman)) {
1221+
elseif (Get-Command pacman -ErrorAction SilentlyContinue) {
12221222
sudo pacman -S --needed --noconfirm unzip
12231223
}
12241224
else {
@@ -1250,7 +1250,7 @@ function setup_7z() {
12501250
$1k.addpath($7z_bin)
12511251
}
12521252
elseif ($IsLinux) {
1253-
if ($(which dpkg)) { sudo apt-get install -y p7zip-full }
1253+
if ($(Get-Command dpkg -ErrorAction SilentlyContinue)) { sudo apt-get install -y p7zip-full }
12541254
}
12551255
elseif ($IsMacOS) {
12561256
brew install p7zip

1k/pwshi.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ if [ $HOST_OS = 'Darwin' ] ; then
6464
sudo installer -pkg "$pwsh_pkg_out" -target /
6565
elif [ $HOST_OS = 'Linux' ] ; then
6666
distro=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
67+
sudo_cmd=$(command -v sudo)
6768
if command -v dpkg > /dev/null; then # Linux distro: deb (ubuntu)
6869
check_pwsh $pwsh_min_ver $pwsh_ver
6970

70-
sudo_cmd=$(which sudo)
7171
if ! command -v curl >/dev/null 2>&1; then
7272
$sudo_cmd apt-get update
7373
$sudo_cmd apt-get install -y curl
@@ -150,14 +150,6 @@ elif [ $HOST_OS = 'Linux' ] ; then
150150
# install powershell
151151
$sudo_cmd dpkg -i "$pwsh_pkg_out"
152152
$sudo_cmd apt install -f --allow-unauthenticated --yes powershell
153-
elif command -v pacman > /dev/null; then # Linux distro: Arch
154-
# refer: https://ephos.github.io/posts/2018-9-17-Pwsh-ArchLinux
155-
# available pwsh version, refer to: https://aur.archlinux.org/packages/powershell-bin
156-
check_pwsh $pwsh_min_ver
157-
git clone https://aur.archlinux.org/powershell-bin.git $cacheDir/powershell-bin
158-
cd $cacheDir/powershell-bin
159-
makepkg -si --needed --noconfirm
160-
cd -
161153
else
162154
# install generic edition from tar package for other linux distro manually
163155
check_pwsh $pwsh_min_ver $pwsh_ver
@@ -173,7 +165,7 @@ elif [ $HOST_OS = 'Linux' ] ; then
173165
tar xvf $pwsh_pkg_out -C "$pwsh_inst_dir"
174166
fi
175167
chmod +x "$pwsh_path"
176-
sudo ln -s "$pwsh_path" /usr/local/bin/pwsh
168+
$sudo_cmd ln -s "$pwsh_path" /usr/local/bin/pwsh
177169
fi
178170
else
179171
echo "pwshi: Unsupported HOST OS: $HOST_OS"

setup.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ else {
370370
Write-Host "Are want add tsinghua mirror for speed up package install in china region? (y/N)" -NoNewline
371371
$answer = Read-Host
372372
if ($answer -like 'y*') {
373-
$mirror_list = "$tsinghua_mirror`n$mirror_list"
373+
$mirror_list = "Server = $tsinghua_mirror`n$mirror_list"
374374
$mirror_list_tmp_file = (Join-Path $AX_ROOT 'mirrorlist')
375375
[System.IO.File]::WriteAllText($mirror_list_tmp_file, $mirror_list)
376376
sudo mv -f $mirror_list_tmp_file /etc/pacman.d/mirrorlist
@@ -379,7 +379,10 @@ else {
379379
}
380380
381381
$DEPENDS = @(
382+
'gcc',
382383
'git',
384+
'less', # for git diff
385+
'pkgconf',
383386
'cmake',
384387
'make',
385388
'libx11',
@@ -389,12 +392,16 @@ else {
389392
'libxi',
390393
'fontconfig',
391394
'gtk3',
392-
'webkit2gtk',
393395
'vlc',
394396
'wayland',
395397
'wayland-protocols',
396398
'libglvnd'
397399
)
400+
401+
if ($(pacman -Si webkit2gtk -q 2>$null)) {
402+
$DEPENDS += 'webkit2gtk'
403+
}
404+
398405
sudo pacman -S --needed --noconfirm @DEPENDS
399406
}
400407
elseif($LinuxDistro -eq 'fedora') {

0 commit comments

Comments
 (0)