Skip to content

Commit 3d13a86

Browse files
committed
postinstall script for deb and rpm
1 parent c361a25 commit 3d13a86

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
176176
set(CPACK_RPM_PACKAGE_LICENSE "GPLv3")
177177
set(CPACK_RPM_PACKAGE_URL "https://openbangla.org/")
178178
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
179+
configure_file("${CMAKE_SOURCE_DIR}/data/linux/postinst.in" "${CMAKE_BINARY_DIR}/postinst" @ONLY)
180+
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_BINARY_DIR}/postinst")
181+
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/postinst")
179182
# Prevents CPack from generating file conflicts
180183
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/applications" "/usr/share/metainfo" "/usr/share/pixmaps"
181184
"/usr/share/icons" "/usr/share/icons/hicolor"

data/linux/postinst.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -e
3+
4+
@BIN_DIR@/openbangla-gui --setup-system
5+
6+
exit 0

data/productbuild/postinstall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
set -e
33

4-
/Applications/OpenBangla\ Keyboard.app/Contents/MacOS/OpenBangla\ Keyboard --setup-macos
4+
/Applications/OpenBangla\ Keyboard.app/Contents/MacOS/OpenBangla\ Keyboard --setup-system
55

66
exit 0

src/frontend/PlatformConfig.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,7 @@ void setupInputSources() {
551551
setupLXQtIME();
552552
} else if(de == DesktopEnvironment::macOS) {
553553
#ifdef Q_OS_MACOS
554-
bool enabled = macOS::getInputSourceEnabled();
555-
LOG_DEBUG("OpenBangla Input Source Enabled: %s\n", enabled ? "true" : "false");
554+
macOS::setupOpenBanglaInputSource();
556555
#endif
557556
} else {
558557
LOG_DEBUG("Desktop Environment not supported for input source setup\n");

src/frontend/main.cpp

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,26 +45,18 @@ int main(int argc, char *argv[]) {
4545
parser.addVersionOption();
4646
QCommandLineOption darkIcon("dark","Enable dark theme support");
4747
QCommandLineOption startInTray("tray","Start in tray");
48+
QCommandLineOption setupSystem("setup-system","Setup OpenBangla input source");
4849
parser.addOption(darkIcon);
4950
parser.addOption(startInTray);
50-
51-
#ifdef Q_OS_MACOS
52-
QCommandLineOption setTIS("setup-macos","Setup macOS input source");
53-
parser.addOption(setTIS);
54-
#endif
55-
51+
parser.addOption(setupSystem);
5652
parser.process(app);
53+
54+
LOG_INFO("Detected Desktop Environment: %s\n", desktopEnvironmentToString(detectDesktopEnvironment()).toStdString().c_str());
5755

58-
#ifdef Q_OS_MACOS
59-
if(parser.isSet(setTIS)) {
60-
macOS::setupOpenBanglaInputSource();
61-
return 0;
62-
}
63-
#endif
64-
65-
LOG_DEBUG("Detected Desktop Environment: %s\n", desktopEnvironmentToString(detectDesktopEnvironment()).toStdString().c_str());
66-
67-
setupInputSources();
56+
if(parser.isSet(setupSystem)) {
57+
setupInputSources();
58+
return 0;
59+
}
6860

6961
// Prevent many instances of the app to be launched
7062
QString name = "com.openbangla.keyboard";

0 commit comments

Comments
 (0)