Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.

Commit fd54035

Browse files
committed
Merge pull request #433 from radicaled/linux_targzip
[LINUX] build a .tar.gz to be unpacked anywhere.
2 parents 4b6a5d1 + e2b2017 commit fd54035

File tree

6 files changed

+162
-0
lines changed

6 files changed

+162
-0
lines changed

installer/linux/archive/README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Setup
2+
=====
3+
4+
Run ./install to install the .desktop file and brackets command line tool to your ~/.local directory.
5+
Run ./uninstall to remove these files.
6+
7+
Requires libudev.so.0. install.sh will attempt to symlink this file automatically if it exists.
8+
9+
If you see a libudev-related error message, you may need to do this:
10+
11+
# 64-bit Fedora system.
12+
ln -s /usr/lib64/libudev.so.1 /usr/lib64/libudev.so.0
13+
# 32-bit Fedora system
14+
ln -s /usr/lib/libudev.so.1 /usr/lib/libudev.so.0
15+
16+
If you are unsure of your library directory, you can run the following command and examine its output to find the right path:
17+
18+
ldd Brackets
19+
# Sample output:
20+
# libpangocairo-1.0.so.0 => /lib64/libpangocairo-1.0.so.0 (0x00007f482aed6000)
21+
# libatk-1.0.so.0 => /lib64/libatk-1.0.so.0 (0x00007f482acb3000)
22+
23+
In the example above, the library path is /lib64.
24+
25+
Happy hacking.
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Desktop Entry]
2+
Name=Brackets
3+
Type=Application
4+
Categories=Development
5+
Exec=brackets %U
6+
Icon=brackets
7+
MimeType=text/html;text/css;application/javascript;text/javascript;

installer/linux/archive/install.sh

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
echo 'installing brackets to your ~/.local directory'
3+
4+
curDir=$(pwd)
5+
6+
mkdir -p ~/.local/share/applications
7+
mkdir -p ~/.local/bin
8+
9+
# Setup our brackets.desktop file.
10+
cp brackets.desktop temp.desktop
11+
execPath="$curDir/brackets"
12+
iconPath="$curDir/brackets.svg"
13+
14+
sed -i 's|Exec=brackets|Exec='$execPath'|g' temp.desktop
15+
sed -i 's|Icon=brackets|Icon='$iconPath'|g' temp.desktop
16+
cp temp.desktop ~/.local/share/applications/brackets.desktop
17+
rm temp.desktop
18+
19+
# Run xdg-desktop-menu to register the .desktop file.
20+
# This is for Unity's benefit: Gnome 3 and KDE 4 both watch ~/.local/share/applications and install .desktop files automatically.
21+
# Copy-pasta this straight from the .deb's postinst script.
22+
XDG_DESKTOP_MENU="`which xdg-desktop-menu 2> /dev/null`"
23+
if [ ! -x "$XDG_DESKTOP_MENU" ]; then
24+
echo "Error: Could not find xdg-desktop-menu" >&2
25+
exit 1
26+
fi
27+
"$XDG_DESKTOP_MENU" install ~/.local/share/applications/brackets.desktop --novendor
28+
29+
# Symlink brackets executable to our current location... where-ever that is.
30+
rm -f ~/.local/bin/brackets
31+
ln -s $execPath ~/.local/bin/brackets
32+
33+
# Try to symlink libudev.so.0 to the current directory.
34+
# Gratefully borrowed from https://github.com/rogerwang/node-webkit/wiki/The-solution-of-lacking-libudev.so.0
35+
paths=(
36+
"/lib/x86_64-linux-gnu/libudev.so.1" # Ubuntu, Xubuntu, Mint
37+
"/usr/lib64/libudev.so.1" # SUSE, Fedora
38+
"/usr/lib/libudev.so.1" # Arch, Fedora 32bit
39+
"/lib/i386-linux-gnu/libudev.so.1" # Ubuntu 32bit
40+
)
41+
for i in "${paths[@]}"
42+
do
43+
if [ -f $i ]
44+
then
45+
ln -sf "$i" $curDir/libudev.so.0
46+
break
47+
fi
48+
done
49+
50+
echo 'installed brackets to ~/.local'

installer/linux/archive/uninstall.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
echo 'uninstalling brackets from your ~/.local directory'
3+
echo 'run with -c to remove ~/.config/Brackets'
4+
5+
removeConfig=false
6+
7+
while getopts c opt; do
8+
case $opt in
9+
c)
10+
removeConfig=true
11+
;;
12+
esac
13+
done
14+
15+
shift $((OPTIND - 1))
16+
17+
if [ "$removeConfig" = true ]; then
18+
echo 'deleting ~/.config/Brackets'
19+
rm -rf ~/.config/Brackets
20+
fi
21+
22+
# Safety first: only uninstall files we know about.
23+
24+
rm -f ~/.local/bin/brackets
25+
rm -f ~/.local/share/applications/brackets.desktop
26+
27+
echo 'finished uninstall brackets from your ~/.local directory'

installer/linux/build_archive.sh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# grunt-contrib-copy doesn't preserve permissions
4+
# https://github.com/gruntjs/grunt/issues/615
5+
chmod 755 debian/package-root/opt/brackets/brackets
6+
chmod 755 debian/package-root/opt/brackets/Brackets
7+
chmod 755 debian/package-root/opt/brackets/Brackets-node
8+
9+
# set permissions on subdirectories
10+
find debian -type d -exec chmod 755 {} \;
11+
12+
# delete old package
13+
rm -f brackets.tar.gz
14+
15+
# Move everything we'll be using to a temporary directory for easy clean-up
16+
mkdir -p archive/out
17+
cp -r debian/package-root/opt/brackets archive/out
18+
19+
# Add brackets.svg
20+
cp debian/package-root/usr/share/icons/hicolor/scalable/apps/brackets.svg archive/out/brackets
21+
22+
# Add the modified brackets.desktop file (call brackets instead of /opt/brackets/brackets)
23+
cp archive/brackets.desktop archive/out/brackets
24+
25+
# Add the install.sh and uninstall.sh files.
26+
cp archive/install.sh archive/out/brackets
27+
cp archive/uninstall.sh archive/out/brackets
28+
# README.md too.
29+
cp archive/README.md archive/out/brackets
30+
31+
tar -cf brackets.tar -C archive/out brackets/
32+
33+
gzip brackets.tar
34+
35+
# Clean-up after ourselves once the tarball has been generated.
36+
rm -rf archive/out

tasks/build.js

+17
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,21 @@ module.exports = function (grunt) {
245245
done(false);
246246
});
247247
});
248+
249+
// task: build-linux-archive
250+
grunt.registerTask("build-linux-archive", "Build portable Linux .tar.gz", function() {
251+
grunt.task.requires(["package"]);
252+
253+
var done = this.async(),
254+
sprint = semver.parse(grunt.config("pkg").version).minor;
255+
256+
spawn(["bash build_archive.sh"], { cwd: resolve("installer/linux"), env: getBracketsEnv() }).then(function () {
257+
return common.rename("installer/linux/brackets.tar.gz", "installer/linux/Brackets Sprint " + sprint + " " + common.arch() + "-bit.tar.gz");
258+
}).then(function () {
259+
done();
260+
}, function (err) {
261+
grunt.log.error(err);
262+
done(false);
263+
});
264+
});
248265
};

0 commit comments

Comments
 (0)