-
Notifications
You must be signed in to change notification settings - Fork 24
/
generate-appimaged-extension
51 lines (36 loc) · 1.25 KB
/
generate-appimaged-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
#!/bin/bash
HERE="$(dirname "$(readlink -f "${0}")")"
mkdir -p /tmp/appimaged_x86_64
cd /tmp/appimaged_x86_64
mkdir -p ./usr/bin/
cat > ./usr/bin/appimagedlauncher <<\EOF
#!/bin/bash
# Launch the most recent (as per modification time)
# appimaged AppImage from the Applications directory
# of the first mounted vfat partition (which is where
# Live ISOs are usually mounted from by SystemImageKit)
"$(mount | grep fat | head -n 1 | cut -d " " -f 3)/Applications/$(ls -at /$(mount | grep fat | head -n 1 | cut -d " " -f 3)/Applications/ | grep -e "^appimaged-.*.AppImage" | head -n 1)" "$@"
EOF
chmod +x ./usr/bin/appimagedlauncher
mkdir -p etc/systemd/user/
cat > etc/systemd/user/appimaged.service <<\EOF
[Unit]
Description=AppImage system integration daemon
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/usr/bin/appimagedlauncher
RestartSec=3
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=appimaged
Environment=LAUNCHED_BY_SYSTEMD=1
[Install]
WantedBy=default.target
EOF
# Not sure whether this works...
mkdir -p etc/systemd/user/default.target.wants
( cd etc/systemd/user/ ; ln -s appimaged.service default.target.wants/ )
mksquashfs . "${HERE}/../customize/x86_64/appimaged.ExtensionImage" -noappend
cd -