Skip to content

Commit 0e9d850

Browse files
probonopdandyleejordan
authored andcommitted
Add AppImage tooling
* Use icon from local repository PowerShell#2027 (comment) * Use the deb that has been generated in this build * Copyright and license PowerShell#2027 (comment) * MIT License for appimage.sh PowerShell#2027 (comment) * Full text of the MIT License is in license_thirdparty_proprietary.txt * Clarify license and clean up unused code PowerShell#2027 (comment) * Mark appimage.sh as executable
1 parent 5a8fa57 commit 0e9d850

2 files changed

Lines changed: 163 additions & 1 deletion

File tree

license_thirdparty_proprietary.txt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,4 +720,25 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
720720
prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois
721721
de votre pays si celles-ci ne le permettent pas.
722722

723-
723+
The following components are governed by the MIT license, a copy of which appears
724+
below the list of components:
725+
------------------------------------------------------
726+
tools/appimage.sh
727+
------------------------------------------------------
728+
Copyright (c) 2016 Simon Peter
729+
All rights reserved.
730+
MIT License
731+
Permission is hereby granted, free of charge, to any person obtaining a copy of this
732+
software and associated documentation files (the "Software"), to deal in the Software
733+
without restriction, including without limitation the rights to use, copy, modify,
734+
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
735+
permit persons to whom the Software is furnished to do so, subject to the following
736+
conditions:
737+
The above copyright notice and this permission notice shall be included in all copies
738+
or substantial portions of the Software.
739+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
740+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
741+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
742+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
743+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
744+
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

tools/appimage.sh

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
#!/bin/bash
2+
3+
# This code is based on an example recipe from the AppImage project,
4+
# https://github.com/probonopd/AppImages/blob/e05cbebc62c86f8c602d74d9050bbfbf10df1c69/recipes/powershell/Recipe
5+
# Copyright (c) 2016 Simon Peter
6+
# The license of this code and of https://github.com/probonopd/AppImages/raw/e05cbebc62c86f8c602d74d9050bbfbf10df1c69/functions.sh
7+
# is the MIT License, see https://github.com/probonopd/AppImages/blob/e05cbebc62c86f8c602d74d9050bbfbf10df1c69/LICENSE
8+
#
9+
# Generate AppImage, http://appimage.org
10+
#
11+
# The resulting PowerShell AppImage is known to run on
12+
# CentOS-7.0-1406-x86_64-GnomeLive.iso
13+
# CentOS-7-x86_64-LiveGNOME-1511.iso
14+
# Chromixium-1.5-amd64.iso
15+
# Fedora-Live-Workstation-x86_64-22-3.iso
16+
# Fedora-Live-Workstation-x86_64-23-10.iso
17+
# SL-72-x86_64-2016-02-03-LiveDVDgnome.iso
18+
# debian-live-8.0.0-amd64-xfce-desktop+nonfree.iso
19+
# debian-live-8.4.0-amd64-gnome-desktop.iso
20+
# elementary_OS_0.3_freya_amd64.iso
21+
# kali-linux-2.0-amd64.iso
22+
# kali-linux-2016.1-amd64.iso
23+
# kubuntu-14.04.4-desktop-amd64.iso
24+
# kubuntu-15.04-desktop-amd64.iso
25+
# kubuntu-16.04-desktop-amd64.iso
26+
# linuxmint-17.3-cinnamon-64bit.iso
27+
# neon-devedition-gitunstable-20160814-0806-amd64.iso
28+
# netrunner-17-64bit.iso
29+
# ubuntu-14.04.1-desktop-amd64.iso
30+
# ubuntu-16.04-desktop-amd64.iso
31+
# ubuntu-gnome-16.04-desktop-amd64.iso
32+
# ubuntu-mate-16.04-desktop-amd64.iso
33+
# xubuntu-16.04-desktop-amd64.iso
34+
35+
APP=powershell
36+
37+
mkdir -p ./$APP/$APP.AppDir/usr/lib
38+
39+
cd ./$APP/
40+
41+
wget -q https://github.com/probonopd/AppImages/raw/e05cbebc62c86f8c602d74d9050bbfbf10df1c69/functions.sh -O ./functions.sh
42+
. ./functions.sh
43+
44+
# We get this app and almost all its dependencies via apt-get
45+
# but not using the host system's information about what is
46+
# installed on the system but our own assumptions instead
47+
48+
mkdir -p ./tmp/archives/
49+
mkdir -p ./tmp/lists/partial
50+
touch tmp/pkgcache.bin tmp/srcpkgcache.bin
51+
52+
generate_status
53+
54+
echo "deb http://archive.ubuntu.com/ubuntu/ trusty main universe
55+
" > sources.list
56+
57+
OPTIONS="-o Debug::NoLocking=1
58+
-o APT::Cache-Limit=125829120
59+
-o Dir::Etc::sourcelist=./sources.list
60+
-o Dir::State=./tmp
61+
-o Dir::Cache=./tmp
62+
-o Dir::State::status=./status
63+
-o Dir::Etc::sourceparts=-
64+
-o APT::Get::List-Cleanup=0
65+
-o APT::Get::AllowUnauthenticated=1
66+
-o Debug::pkgProblemResolver=true
67+
-o Debug::pkgDepCache::AutoInstall=true
68+
-o APT::Install-Recommends=0
69+
-o APT::Install-Suggests=0
70+
"
71+
72+
cp ../powershell_*_amd64.deb .
73+
74+
# Add local repository so that we can install deb files
75+
# that were downloaded outside of a repository
76+
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
77+
echo "deb file:$(readlink -e $PWD) ./" >> sources.list
78+
79+
apt-get $OPTIONS update
80+
81+
URLS=$(apt-get $OPTIONS -y install --print-uris $APP | cut -d "'" -f 2 | grep -e "^http")
82+
83+
wget -c $URLS
84+
85+
cd ./$APP.AppDir/
86+
87+
find ../*.deb -exec dpkg -x {} . \; || true
88+
89+
rm usr/bin/powershell
90+
mv opt/microsoft/powershell/*/* usr/bin/
91+
92+
cat > $APP.desktop <<\EOF
93+
[Desktop Entry]
94+
Name=PowerShell
95+
Comment=Microsoft PowerShell
96+
Exec=powershell
97+
Keywords=shell;prompt;command;commandline;cmd;
98+
Icon=powershell
99+
Type=Application
100+
Categories=System;TerminalEmulator;
101+
StartupNotify=true
102+
Terminal=true
103+
EOF
104+
105+
cp ../../assets/Powershell_256.png $APP.png
106+
107+
cat > ./AppRun <<\EOF
108+
#!/bin/sh
109+
HERE=$(dirname $(readlink -f "${0}"))
110+
export PATH="${HERE}/usr/bin/":$PATH
111+
export LD_LIBRARY_PATH="${HERE}/usr/lib/":$LD_LIBRARY_PATH
112+
exec "${HERE}/usr/bin/powershell.wrapper" "$@"
113+
EOF
114+
chmod a+x ./AppRun
115+
116+
move_lib
117+
mv ./usr/lib/x86_64-linux-gnu/* ./usr/lib/ # AppRun sets Qt env here
118+
119+
mv ./usr/lib/pulseaudio/*.so usr/lib/ || true
120+
121+
mv usr/local/share/man usr/share/ || true
122+
123+
delete_blacklisted
124+
rm -rf ./etc/ ./home/ ./lib/ || true
125+
rm -r opt/ usr/lib/x86_64-linux-gnu/ usr/lib64 usr/share/ || true
126+
127+
VERSION=$(find ../*.deb -name $APP"_*" | head -n 1 | cut -d "~" -f 1 | cut -d "_" -f 2 | cut -d "-" -f 1-2 | sed -e 's|1%3a||g')
128+
echo $VERSION
129+
130+
get_desktopintegration $APP
131+
sed -i -e 's|^echo|# echo|g' usr/bin/$APP.wrapper # Make less verbose
132+
133+
# Go out of AppImage
134+
cd ..
135+
136+
ARCH="x86_64"
137+
generate_appimage
138+
139+
cp ../out/*AppImage ..
140+
141+
cd ..

0 commit comments

Comments
 (0)