Skip to content

move systemd files to /usr & use fpm instead of install scripts for debs #446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/tmp
/out-tsc
/usr
/etc
# Only exists if Bazel was run
/bazel-out

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ tuxedo-control-center
3. Install service file that points to development build path (or use installed service from packaged version)

Manual instructions:
1. Copy `tccd.service` and `tccd-sleep.service` (from src/dist-data) to `/etc/systemd/system/`
1. Copy `tccd.service` and `tccd-sleep.service` (from src/dist-data) to `/usr/local/lib/systemd/system/`
2. Edit the `tccd.service` (exec start/stop) to point to `<dev path>/dist/tuxedo-control-center/data/service/tccd`.
3. Copy `com.tuxedocomputers.tccd.conf` to `/usr/share/dbus-1/system.d/`
4. Start service `systemctl start tccd`. (And enable for autostart `systemctl enable tccd tccd-sleep`)
Expand Down
4 changes: 2 additions & 2 deletions build-src/after_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ cp ${DIST_DATA}/com.tuxedocomputers.tccd.conf /usr/share/dbus-1/system.d/com.tux
cp ${DIST_DATA}/com.tuxedocomputers.tomte.policy /usr/share/polkit-1/actions/com.tuxedocomputers.tomte.policy || true

# Copy and enable services
cp ${DIST_DATA}/tccd.service /etc/systemd/system/tccd.service || true
cp ${DIST_DATA}/tccd-sleep.service /etc/systemd/system/tccd-sleep.service || true
cp ${DIST_DATA}/tccd.service /usr/lib/systemd/system/tccd.service || true
cp ${DIST_DATA}/tccd-sleep.service /usr/lib/systemd/system/tccd-sleep.service || true
systemctl daemon-reload
systemctl enable tccd tccd-sleep
systemctl restart tccd
Expand Down
8 changes: 8 additions & 0 deletions build-src/after_install_deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# In case TFC service is active, deactivate
systemctl stop tuxedofancontrol > /dev/null 2>&1 || true
systemctl disable tuxedofancontrol > /dev/null 2>&1 || true

# SUID chrome-sandbox for Electron 5+
chmod 4755 '/opt/tuxedo-control-center/chrome-sandbox' || true
2 changes: 2 additions & 0 deletions build-src/after_purge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
rm -rf /etc/tcc/ || true
23 changes: 9 additions & 14 deletions build-src/electron-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,15 @@ async function buildDeb(filenameAddition: string): Promise<void> {
},

files: [
distSrc + '/**/*'
distSrc + '/**/*',
],
extraResources: [
distSrc + '/data/service/tccd',
distSrc + '/data/service/TuxedoIOAPI.node',
distSrc + '/data/CHANGELOG.md',
distSrc + '/data/dist-data/tccd.service',
distSrc + '/data/dist-data/tccd-sleep.service',
distSrc + '/data/dist-data/tuxedo-control-center_256.svg',
distSrc + '/data/dist-data/tuxedo-control-center.desktop',
distSrc + '/data/dist-data/tuxedo-control-center-tray.desktop',
distSrc + '/data/dist-data/com.tuxedocomputers.tccd.policy',
distSrc + '/data/dist-data/com.tuxedocomputers.tccd.conf',
distSrc + '/data/camera/cameractrls.py',
distSrc + '/data/dist-data/99-webcam.rules',
distSrc + '/data/dist-data/com.tuxedocomputers.tomte.policy',
distSrc + '/data/camera/v4l2_kernel_names.json'
distSrc + '/data/camera/v4l2_kernel_names.json',
],
linux: {
target: [
Expand All @@ -79,12 +71,16 @@ async function buildDeb(filenameAddition: string): Promise<void> {
deb: {
depends: ['tuxedo-drivers (>= 4.0.0) | tuxedo-keyboard (>= 3.1.2)', 'libayatana-appindicator3-1'],
category: 'System',
afterInstall: "./build-src/after_install.sh",
afterRemove: "./build-src/after_remove.sh",
afterInstall: "./build-src/after_install_deb.sh",
fpm: [
'--conflicts=tuxedofancontrol',
'--replaces=tuxedofancontrol',
'--inputs=build-src/package-files.txt'
'--inputs=build-src/package-files.txt',
'--deb-systemd=src/dist-data/tccd.service',
'--deb-systemd=src/dist-data/tccd-sleep.service',
'--deb-systemd-restart-after-upgrade',
'--deb-after-purge=build-src/after_purge.sh',
'--deb-upstream-changelog=CHANGELOG.md'
]
}
};
Expand Down Expand Up @@ -140,7 +136,6 @@ async function buildRpm(filenameAddition: string): Promise<void> {
},
rpm: {
depends: ['(tuxedo-drivers >= 4.0.0 or tuxedo-keyboard >= 3.1.2)', '(libayatana-appindicator3-1 or libappindicator or libappindicator3-1)'],
afterInstall: './build-src/dummy.sh',
afterRemove: './build-src/after_remove.sh',
fpm: [
'--replaces=tuxedofancontrol <= 0.1.9',
Expand Down
9 changes: 8 additions & 1 deletion build-src/package-files.txt
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
usr/share/metainfo/com.tuxedocomputers.tcc.metainfo.xml
usr/share/metainfo/com.tuxedocomputers.tcc.metainfo.xml
usr/share/polkit-1/actions/com.tuxedocomputers.tccd.policy
usr/share/polkit-1/actions/com.tuxedocomputers.tomte.policy
usr/share/dbus-1/system.d/com.tuxedocomputers.tccd.conf
usr/lib/udev/rules.d/99-tuxedo-webcam.rules
usr/share/applications/tuxedo-control-center.desktop
etc/skel/.config/autostart/tuxedo-control-center-tray.desktop
usr/bin/tuxedo-control-center
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,22 @@
"build-service": "tsc -p ./src/service-app && cp ./src/package.json ./dist/tuxedo-control-center/service-app/package.json && run-s bundle-service",
"bundle-service": "cp ./build/Release/TuxedoIOAPI.node ./dist/tuxedo-control-center/service-app/native-lib && pkg --target node14-linux-x64 --output ./dist/tuxedo-control-center/data/service/tccd ./dist/tuxedo-control-center/service-app/package.json",
"build-native": "node-gyp configure && node-gyp rebuild",
"copy-files": "run-s copy-package-json copy-dist-files copy-cameractls copy-udev-rule",
"copy-files": "run-s copy-package-json copy-dist-files copy-desktop-files copy-policy-files copy-dbus-file copy-cameractls copy-udev-rule copy-symlink-files",
"copy-package-json": "cp ./src/package.json ./dist/tuxedo-control-center/package.json",
"copy-policy-files": " mkdir -p ./usr/share/polkit-1/actions/ && cp ./src/dist-data/com.tuxedocomputers.tccd.policy ./src/dist-data/com.tuxedocomputers.tomte.policy ./usr/share/polkit-1/actions/",
"copy-dbus-file": " mkdir -p ./usr/share/dbus-1/system.d/ && cp ./src/dist-data/com.tuxedocomputers.tccd.conf ./usr/share/dbus-1/system.d/",
"copy-dist-files": "cp -r ./src/dist-data ./dist/tuxedo-control-center/data && mkdir -p ./usr/share/metainfo && cp ./src/dist-data/com.tuxedocomputers.tcc.metainfo.xml ./usr/share/metainfo",
"copy-symlink-files": "mkdir -p ./usr/bin/ && cp -P ./src/dist-data/tuxedo-control-center ./usr/bin/",
"copy-desktop-files": " mkdir -p ./usr/share/applications/ ./etc/skel/.config/autostart && cp ./src/dist-data/tuxedo-control-center.desktop ./usr/share/applications/ && cp ./src/dist-data/tuxedo-control-center-tray.desktop ./etc/skel/.config/autostart",
"copy-changelog": "cp CHANGELOG.md ./src/ng-app/assets/",
"copy-cameractls": "mkdir -p ./dist/tuxedo-control-center/data/camera && cp ./src/cameractrls/cameractrls.py ./src/cameractrls/v4l2_kernel_names.json ./dist/tuxedo-control-center/data/camera",
"copy-udev-rule": "cp ./src/udev/99-webcam.rules ./dist/tuxedo-control-center/data/dist-data",
"copy-udev-rule": "mkdir -p ./usr/lib/udev/rules.d/ && cp ./src/udev/99-webcam.rules ./usr/lib/udev/rules.d/99-tuxedo-webcam.rules",
"electron-builder": "USE_HARD_LINKS=false TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ./build-src/electron-builder.ts",
"pack": "run-s build && npm run electron-builder",
"build-release": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ./build-src/build-release.ts",
"check-release": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ./build-src/check-release.ts",
"pack-prod": "run-s build-prod && npm run electron-builder",
"clean": "rm -rf ./dist; rm -rf ./build; rm -rf ./usr",
"clean": "rm -rf ./dist; rm -rf ./build; rm -rf ./usr; rm -rf ./etc",
"tests": "npm run test-common && npm run test-service-app && npm run test-appstream",
"test-common": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node node_modules/jasmine/bin/jasmine --config=./src/common/jasmine.json",
"test-service-app": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node node_modules/jasmine/bin/jasmine --config=./src/service-app/jasmine.json",
Expand Down
1 change: 1 addition & 0 deletions src/dist-data/tuxedo-control-center