-
Notifications
You must be signed in to change notification settings - Fork 14
/
snapcraft.yaml
119 lines (112 loc) · 4.64 KB
/
snapcraft.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: powershell-preview
icon: assets/icon.png
grade: stable
adopt-info: powershell-preview
base: core18
summary: PowerShell for every system!
description: |
PowerShell is an automation and configuration management platform.
It consists of a cross-platform (Windows, Linux, and macOS)
command-line shell and associated scripting language.
See https://docs.microsoft.com/en-us/powershell/scripting/powershell-core-support for support details.
confinement: classic
apps:
powershell-preview:
command: bin/powershell-wrapper
environment:
POWERSHELL_DISTRIBUTION_CHANNEL: PSSnap
CLR_ICU_VERSION_OVERRIDE: 60.2
parts:
# A wrapper script
launchers:
plugin: dump
source: .
organize:
launcher/powershell-wrapper: bin/powershell-wrapper
filesets:
wrapper: [bin/powershell-wrapper]
stage: [$wrapper]
prime: [$wrapper]
powershell-preview:
after: [launchers]
plugin: nil
override-pull: |
snapcraftctl pull
file="./version.txt"
if [ -f "$file" ]
then
version=$(cat $file)
else
version=$(curl -s 'https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json' | jq .PreviewReleaseTag | sed 's/"//g' | sed 's/v//')
fi
snapcraftctl set-version "$version"
snapcraftctl set-grade "stable"
override-build: |
file="./version.txt"
if [ -f "$file" ]
then
echo "using version file"
version=$(cat $file)
else
echo "getting latest version from GitHub"
version=$(curl -s 'https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json' | jq .PreviewReleaseTag | sed 's/"//g' | sed 's/v//')
echo "Writing version to file"
echo $version > $file
fi
echo "getting powershell $version"
case "$SNAPCRAFT_ARCH_TRIPLET" in
aarch64-linux-gnu)
curl -L -o powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v$version/powershell-$version-linux-arm64.tar.gz ;;
arm-linux-gnueabihf)
curl -L -o powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v$version/powershell-$version-linux-arm32.tar.gz ;;
*)
curl -L -o powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v$version/powershell-$version-linux-x64.tar.gz ;;
esac
echo "getting Third Party Notice Header"
curl -L -o thirdPartyNoticeHeader.txt https://raw.githubusercontent.com/PowerShell/PowerShell-Snap/master/assets/thirdPartyNoticeHeader.txt
mkdir -p $SNAPCRAFT_PART_INSTALL/opt/powershell
tar zxf powershell.tar.gz -C $SNAPCRAFT_PART_INSTALL/opt/powershell
echo 'updating rpath...'
patchelf --force-rpath --set-rpath '$ORIGIN/netcoredeps:$ORIGIN/../../usr/lib/x86_64-linux-gnu' $SNAPCRAFT_PART_INSTALL/opt/powershell/pwsh
echo 'new rpath'
patchelf --print-rpath $SNAPCRAFT_PART_INSTALL/opt/powershell/pwsh
echo 'fixed rpath'
chmod +x $SNAPCRAFT_PART_INSTALL/opt/powershell/pwsh
echo "fixing symlinks"
find $SNAPCRAFT_PART_INSTALL -type l -ls
rm $SNAPCRAFT_PART_INSTALL/opt/powershell/libcrypto.so.1.0.0
rm $SNAPCRAFT_PART_INSTALL/opt/powershell/libssl.so.1.0.0
echo "removed old symlinks"
ln -sfn ../../usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 $SNAPCRAFT_PART_INSTALL/opt/powershell/libcrypto.so.1.0.0
ln -sfn ../../usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 $SNAPCRAFT_PART_INSTALL/opt/powershell/libssl.so.1.0.0
echo "added new symlinks"
find $SNAPCRAFT_PART_INSTALL -type l -ls
echo "checking for targets"
find $SNAPCRAFT_PART_INSTALL -iname libcrypto.so.* -ls
find $SNAPCRAFT_PART_INSTALL -iname libssl.so.* -ls
echo "fixed symlinks"
thirdPartyNoticeFile="$SNAPCRAFT_PART_INSTALL/thirdPartyNotices.txt"
echo "building third party notices file - $thirdPartyNoticeFile"
cat thirdPartyNoticeHeader.txt > $thirdPartyNoticeFile
find $SNAPCRAFT_PART_INSTALL -type f -name 'copyright' -print | while read filename; do
libname=$(dirname $filename | sed 's,^\(.*/\)\?\([^/]*\),\2,')
echo ''
echo '---------------------------------------------'
echo "Package - $libname"
echo '---------------------------------------------'
cat "$filename"
done >> $thirdPartyNoticeFile
echo "Done building third party notices file - $thirdPartyNoticeFile"
stage-packages:
- libicu60
- liblttng-ust0
- libssl1.0.0
- libssl1.1
- zlib1g
- libc6
- libgcc1
- libstdc++6
build-packages:
- curl
- jq
- patchelf