Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
azubieta committed Dec 14, 2019
2 parents 080e742 + 4f2b9b8 commit b4fc9bf
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ build:debian_buster_pkg:
script:
- cmake -DINSTALL_LIBAPPIMAGE=On -DINSTALL_ATTICA=On -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release .
- make -j`nproc`
- cpack -G DEB -G DEB -R 1.0.1-debian-buster
- cpack -G DEB -G DEB -R 1.0.2-debian-buster
artifacts:
paths:
- appimage-installer*.deb
Expand All @@ -79,7 +79,7 @@ build:ubuntu_bionic_pkg:
script:
- cmake -DINSTALL_LIBAPPIMAGE=On -DINSTALL_ATTICA=On -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release .
- make -j`nproc`
- cpack -G DEB -G DEB -R 1.0.1-ubuntu-bionic
- cpack -G DEB -G DEB -R 1.0.2-ubuntu-bionic
artifacts:
expire_in: 1 year
paths:
Expand Down
2 changes: 1 addition & 1 deletion .travis/arch/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
projectname=appimage-installer

pkgname=appimage-installer
pkgver=1.0.1
pkgver=1.0.2
pkgrel=1
epoch=
pkgdesc="AppImage Installer"
Expand Down
2 changes: 1 addition & 1 deletion .travis/debian_buster/build_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ fi

mkdir docker-build-release
sudo docker run -v ${PWD}:/source -v ${PWD}/docker-build-release:/build ${DOCKER_IMAGE} \
/bin/bash -c "cmake -DINSTALL_LIBAPPIMAGE=On -DINSTALL_ATTICA=On -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release /source && make -j`nproc` && cpack -G DEB -G DEB -R 1.0.1-debian-buster"
/bin/bash -c "cmake -DINSTALL_LIBAPPIMAGE=On -DINSTALL_ATTICA=On -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release /source && make -j`nproc` && cpack -G DEB -G DEB -R 1.0.2-debian-buster"
2 changes: 1 addition & 1 deletion .travis/ubuntu_bionic/build_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ fi

mkdir docker-build-release
sudo docker run -v ${PWD}:/source -v ${PWD}/docker-build-release:/build ${DOCKER_IMAGE} \
/bin/bash -c "cmake -DINSTALL_LIBAPPIMAGE=On -DINSTALL_ATTICA=On -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release /source && make -j`nproc` && cpack -G DEB -R 1.0.1-ubuntu-bionic"
/bin/bash -c "cmake -DINSTALL_LIBAPPIMAGE=On -DINSTALL_ATTICA=On -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release /source && make -j`nproc` && cpack -G DEB -R 1.0.2-ubuntu-bionic"
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.8)

project(appimage-installer VERSION 1.0.1)
project(appimage-installer VERSION 1.0.2)

set(CMAKE_CXX_STANDARD 11)

Expand Down
2 changes: 1 addition & 1 deletion cmake/versioning.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

set(APPIMAGE_INSTALLER_V_MAJOR 1)
set(APPIMAGE_INSTALLER_V_MINOR 0)
set(APPIMAGE_INSTALLER_V_PATCH 1)
set(APPIMAGE_INSTALLER_V_PATCH 2)

set(APPIMAGE_INSTALLER_VERSION ${APPIMAGE_INSTALLER_V_MAJOR}.${APPIMAGE_INSTALLER_V_MINOR}.${APPIMAGE_INSTALLER_V_PATCH}${APPIMAGE_INSTALLER_V_SUFFIX})

Expand Down
41 changes: 30 additions & 11 deletions src/cli/commands/InstallCommand.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// system
#include <fstream>

extern "C" {
#include <sys/ioctl.h>
}
Expand Down Expand Up @@ -94,7 +95,33 @@ void InstallCommand::installAppImage() {
auto permissions = targetFile.permissions();
targetFile.setPermissions(permissions | QFileDevice::ReadOwner | QFileDevice::ExeOwner);

// integrate with the desktop environment
// Control the installation order by using a tmp folder

QByteArray real_home = qgetenv("HOME");
QByteArray user = qgetenv("USER");
QByteArray tmp_home_path = "/tmp/appimage-installer-temp-home-" + user;

qputenv("HOME", tmp_home_path);

int res = libappimage_install();

qputenv("HOME", real_home);

QProcess::execute("cp -rf " + tmp_home_path + "/.cache/thumbnails " + real_home + "/.cache/");
QProcess::execute("cp -rf " + tmp_home_path + "/.local/share/icons " + real_home + "/.local/share/");
if (QFile::exists("/usr/bin/kbuildsycoca5"))
QProcess::execute("kbuildsycoca5 --noincremental ");

QProcess::execute("cp -rf " + tmp_home_path + "/.local/share/applications " + real_home + "/.local/share/");

QByteArray result_message = res == 0 ? "Installation completed\n" : "Installation failed\n";
showInlineMessage(result_message);

QProcess::execute("rm -rf " + tmp_home_path);
emit executionCompleted();
}

int InstallCommand::libappimage_install() const {// integrate with the desktop environment
int res = appimage_register_in_system(targetPath.toStdString().c_str(), false);

// add complementary actions
Expand Down Expand Up @@ -132,18 +159,10 @@ void InstallCommand::installAppImage() {

std::ofstream ofstream(desktopFilePath);
ofstream << entry;
}


if (res == 0) {
showInlineMessage("Installation completed");
} else {
showInlineMessage("Installation failed");
}
out << "\n";


emit executionCompleted();
return res;
}

void InstallCommand::handleDownloadFailed(const QString& message) {
Expand Down Expand Up @@ -207,7 +226,7 @@ void InstallCommand::handleGetDownloadLinkJobFinished(Attica::BaseJob* job) {
startFileDownload(download.link());
}
} else
emit executionFailed("Unable to resolve the application download link.");
emit executionFailed("Unable to resolve the application download link.");
}

int InstallCommand::askWhichFileDownload(const QList<Attica::DownloadDescription>& compatibleDownloads) {
Expand Down
2 changes: 2 additions & 0 deletions src/cli/commands/InstallCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ protected slots:
void startFileDownload(const QUrl& downloadLink);

int askWhichFileDownload(const QList<Attica::DownloadDescription>& compatibleDownloads);

int libappimage_install() const;
};

0 comments on commit b4fc9bf

Please sign in to comment.