-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
install diskencrypt dbus plugin to deepin-service-manager Log: daemon process refactor
- Loading branch information
1 parent
35ac7ea
commit 8518957
Showing
29 changed files
with
3,265 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
assets/polkit/policy/org.deepin.filemanager.diskencrypt.policy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE policyconfig PUBLIC | ||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" | ||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd"> | ||
<policyconfig> | ||
<vendor /> | ||
<vendor_url /> | ||
<action id="org.deepin.Filemanager.DiskEncrypt.Encrypt"> | ||
<description>Disk encryption</description> | ||
<message>Authentication is required to encrypt the disk</message> | ||
<message xml:lang="zh_CN">加密磁盘需要认证</message> | ||
<message xml:lang="zh_HK">加密磁片需要認證</message> | ||
<message xml:lang="zh_TW">加密磁片需要認證</message> | ||
<icon_name>folder</icon_name> | ||
<defaults> | ||
<allow_any>no</allow_any> | ||
<allow_inactive>no</allow_inactive> | ||
<allow_active>auth_admin</allow_active> | ||
</defaults> | ||
</action> | ||
<action id="org.deepin.Filemanager.DiskEncrypt.Decrypt"> | ||
<description>Disk encryption</description> | ||
<message>Authentication is required to decrypt the disk</message> | ||
<message xml:lang="zh_CN">取消加密磁盘需要认证</message> | ||
<message xml:lang="zh_HK">取消加密磁片需要認證</message> | ||
<message xml:lang="zh_TW">取消加密磁片需要認證</message> | ||
<icon_name>folder</icon_name> | ||
<defaults> | ||
<allow_any>no</allow_any> | ||
<allow_inactive>no</allow_inactive> | ||
<allow_active>auth_admin</allow_active> | ||
</defaults> | ||
</action> | ||
<action id="org.deepin.Filemanager.DiskEncrypt.ChangePassphrase"> | ||
<description>Disk encryption</description> | ||
<message>Authentication is required to change the passphrase of disk</message> | ||
<message xml:lang="zh_CN">修改磁盘密码需要认证</message> | ||
<icon_name>folder</icon_name> | ||
<defaults> | ||
<allow_any>no</allow_any> | ||
<allow_inactive>no</allow_inactive> | ||
<allow_active>auth_admin</allow_active> | ||
</defaults> | ||
</action> | ||
</policyconfig> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
add_subdirectory(ddplugin-videowallpaper) | ||
option(OPT_ENABLE_VIDEOWALLPAPER OFF) | ||
|
||
if (OPT_ENABLE_VIDEOWALLPAPER) | ||
add_subdirectory(ddplugin-videowallpaper) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
add_subdirectory(daemonplugin-file-encrypt) | ||
if (COMPLIE_ON_V20) | ||
add_subdirectory(daemonplugin-file-encrypt) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if (COMPLIE_ON_V23) | ||
add_subdirectory(diskencrypt) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(BIN_NAME "deepin-diskencrypt-service") | ||
project(${BIN_NAME}) | ||
|
||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
set(CMAKE_AUTOUIC ON) | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
find_package(Qt5 REQUIRED COMPONENTS Core Concurrent DBus) | ||
find_package(deepin-qdbus-service REQUIRED) | ||
find_package(dfm-framework REQUIRED) | ||
find_package(dfm-mount REQUIRED) | ||
find_package(dfm-base REQUIRED) | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(CryptSetup REQUIRED libcryptsetup) | ||
|
||
add_definitions(-DSERVICE_CONFIG_DIR="${CMAKE_INSTALL_PREFIX}/share/deepin-service-manager/") | ||
|
||
# generate dbus xml and adaptor | ||
# DBus: DiskEncryptDBus | ||
# qt5_generate_dbus_interface( | ||
# diskencryptdbus.h | ||
# diskencryptdbus.xml | ||
# OPTIONS -M -S | ||
#) | ||
qt5_add_dbus_adaptor(ADAPTER_SRC | ||
diskencryptdbus.xml | ||
diskencryptdbus.h | ||
DiskEncryptDBus) | ||
|
||
file(GLOB_RECURSE SRC | ||
"${CMAKE_CURRENT_SOURCE_DIR}/*.h" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" | ||
) | ||
|
||
add_executable(${BIN_NAME} | ||
${SRC} | ||
${ADAPTER_SRC} | ||
) | ||
|
||
target_link_libraries(${BIN_NAME} PRIVATE | ||
Qt5::Core | ||
Qt5::Concurrent | ||
Qt5::DBus | ||
${CryptSetup_LIBRARIES} | ||
${dfm-framework_LIBRARIES} | ||
${dfm-mount_LIBRARIES} | ||
${dfm-base_LIBRARIES} | ||
${deepin-qdbus-service_LIBRARIES} | ||
) | ||
|
||
target_include_directories(${BIN_NAME} | ||
PUBLIC | ||
${PROJECT_SOURCE_DIR} | ||
${dfm-framework_INCLUDE_DIRS} | ||
${CryptSetup_INCLUDE_DIRS} | ||
${dfm-mount_INCLUDE_DIRS} | ||
${deepin-qdbus-service_INCLUDE_DIR} | ||
) | ||
|
||
install(TARGETS ${BIN_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
install(FILES ${PROJECT_NAME}.json DESTINATION share/deepin-service-manager/other/) | ||
install(FILES org.deepin.filemanager.diskencrypt.conf DESTINATION share/dbus-1/system.d/) | ||
install(FILES org.deepin.Filemanager.DiskEncrypt.service DESTINATION share/dbus-1/system-services/) | ||
|
||
set(PolicyDir "${CMAKE_INSTALL_PREFIX}/share/polkit-1/actions") | ||
install(FILES ${CMAKE_SOURCE_DIR}/assets/polkit/policy/org.deepin.filemanager.diskencrypt.policy | ||
DESTINATION ${PolicyDir}) | ||
install(FILES ${CMAKE_SOURCE_DIR}/assets/polkit/rules/99-dde-file-manager-encrypt.pkla | ||
DESTINATION /etc/polkit-1/localauthority/10-vendor.d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "org.deepin.Filemanager.DiskEncrypt", | ||
"policyStartType": "OnDemand", | ||
"idleTime": 10, | ||
"policy": [ | ||
{ | ||
"path": "/org/deepin/Filemanager/DiskEncrypt" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#ifndef DAEMONPLUGIN_FILE_ENCRYPT_GLOBAL_H | ||
#define DAEMONPLUGIN_FILE_ENCRYPT_GLOBAL_H | ||
|
||
#include "globaltypesdefine.h" | ||
|
||
#include <QtCore/qglobal.h> | ||
#include <QString> | ||
#include <QDebug> | ||
|
||
#if defined(DAEMONPLUGIN_FILE_ENCRYPT_LIBRARY) | ||
# define DAEMONPLUGIN_FILE_ENCRYPT_EXPORT Q_DECL_EXPORT | ||
#else | ||
# define DAEMONPLUGIN_FILE_ENCRYPT_EXPORT Q_DECL_IMPORT | ||
#endif | ||
|
||
#define FILE_ENCRYPT_NS daemonplugin_file_encrypt | ||
#define FILE_ENCRYPT_BEGIN_NS namespace FILE_ENCRYPT_NS { | ||
#define FILE_ENCRYPT_END_NS } | ||
#define FILE_ENCRYPT_USE_NS using namespace FILE_ENCRYPT_NS; | ||
|
||
FILE_ENCRYPT_BEGIN_NS | ||
|
||
struct EncryptParams | ||
{ | ||
QString device; | ||
QString passphrase; | ||
QString cipher; | ||
QString recoveryPath; | ||
QString tpmToken; | ||
|
||
bool isValid() const | ||
{ | ||
return !(device.isEmpty() | ||
&& passphrase.isEmpty() | ||
&& cipher.isEmpty()); | ||
} | ||
}; | ||
|
||
inline constexpr char kDecryptHeaderPrefix[] { "dm_header_decrypt_" }; | ||
|
||
FILE_ENCRYPT_END_NS | ||
#endif // DAEMONPLUGIN_FILE_ENCRYPT_GLOBAL_H |
Oops, something went wrong.