/
generate-aill-extension
104 lines (83 loc) · 4.11 KB
/
generate-aill-extension
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
#!/bin/bash
# To test:
#
# systemctl --user enable appimagelauncherd
# systemctl --user start appimagelauncherd
set -e
HERE="$(dirname "$(readlink -f "${0}")")"
if [ -e /usr/bin/apt-get ] ; then
which mksquashfs || apt-get -y install squashfs-tools
which wget || apt-get -y install wget
# which dpkg || apt-get -y install dpkg
fi
if [ -e /usr/bin/yum ] ; then
which mksquashfs || yum -y install squashfs-tools
which wget || yum -y install wget
# which dpkg || yum -y install dpkg
fi
mkdir -p /tmp/appimagelauncherd_x86_64
cd /tmp/appimagelauncherd_x86_64
# The following directories must exist when the session starts, otherwise the user must log out and in
# for appimagelauncherd to work properly. This is NOT an appimagelauncherd bug. Send a pull request if you can fix this.
# It looks like it is too late here to populate skel, hence this DOES NOT WORK
mkdir -p etc/skel/.local/share/icons/hicolor/{16x16,22x22,24x24,32x32,36x36,48x48,64x64,72x72,96x96,128x128,192x192,256x256,512x512}/apps/
mkdir -p etc/skel/.local/share/icons/hicolor/scalable/apps/
find etc/skel/.local/share/icons -type d -name apps -exec echo echo \"This directory must exist before the session starts in order to work\" \> {}/.note \; > commands
bash -x commands
rm commands
mkdir -p etc/skel/.local/share/applications/appimagekit
echo "This directory must exist before the session starts in order to work" >> etc/skel/.local/share/applications/appimagekit/.note
mkdir -p etc/skel/.local/share/mime/packages/
echo "This directory must exist before the session starts in order to work" >> etc/skel/.local/share/mime/packages/.note
mkdir -p usr/bin
# Get the ID of the last successful build on Travis CI
# DLD=$(wget -q https://github.com/TheAssassin/AppImageLauncher/releases -O - | grep "appimagelauncherd_.*64*.deb" | head -n 1 | cut -d '"' -f 2)
# wget -c "https://github.com/$DLD"
LINK=$(wget -q "https://artifacts.assassinate-you.net/artifactory/AppImageLauncher/" -O - | grep "travis-" | cut -d '"' -f 2 | sort -Vr | head -n 1)
URL=$(wget -q "https://artifacts.assassinate-you.net/artifactory/AppImageLauncher/$LINK/" -O - | grep "amd64.deb" | cut -d '"' -f 2 | head -n 1)
URL=travis-623/appimagelauncher-lite-1.3.1-x86_64.AppImage ### FIXME, hardcoded for now
# wget -c "https://artifacts.assassinate-you.net/artifactory/AppImageLauncher/$LINK/$URL"
wget -c "https://artifacts.assassinate-you.net/artifactory/AppImageLauncher/$URL"
chmod +x appimagelauncher-lite-*.AppImage
ls -lh
./appimagelauncher-lite-*.AppImage --appimage-extract
cp -Rf ./squashfs-root/* . && rm -r ./squashfs-root/*
# Without those, the service doesn't automatically launch on boot
cat > ExtensionRun <<\EOF
#!/bin/sh
mkdir -p /usr/lib/systemd/user/
# Enable per-user launchd unit for all users in a way that users can disable it
systemctl --global enable appimagelauncherd # does not seem to work
# Enable per-user launchd unit for all users, does not seem to work either
mkdir -p /usr/lib/systemd/user/graphical.target.wants/
( cd /usr/lib/systemd/user/graphical.target.wants/ ; ln -s ../appimagelauncherd.service . )
# Really desperate now
mkdir -p /home/me/.config/systemd/user/graphical.target.wants/
ln -s /usr/lib/systemd/user/appimagelauncherd.service /home/me/.config/systemd/user/graphical.target.wants/appimagelauncherd.service
chown -R me /home/me/
EOF
chmod a+x ExtensionRun
# Since all of the above does not work, I am using an autostart file
# but it would nice if systemd could do this on its own
mkdir -p etc/xdg/autostart/
cat > etc/xdg/autostart/appimagelauncherd.desktop <<EOF
[Desktop Entry]
Name=appimagelauncherd
Exec=systemctl --user start appimagelauncherd
Terminal=false
Type=Application
NoDisplay=true
EOF
# Remove leftovers that AILL does not need but that can cripple the system
if [ -e ./usr/lib/binfmt.d ] ; then
rm -rf ./usr/lib/binfmt.d
fi
if [ -e ./usr/lib/systemd/user/appimagelauncherfs.service ] ; then
rm -f ./usr/lib/systemd/user/appimagelauncherfs.service
fi
rm -rf ./usr/lib/libsystemd.so.0 || true
chown -R root:root .
chmod -R a+rx .
mkdir -p "${HERE}/../customize/x86_64/"
mksquashfs . "${HERE}/../customize/x86_64/appimagelauncherd.ExtensionImage" -noappend
cd -