Skip to content

Commit

Permalink
fix: some app run failed in other linux distro
Browse files Browse the repository at this point in the history
* get the runtime info from the latest version.
* the default LINGLONG_ROOT_PATH should be /var/lib/linglong.
* if the VERSION_ID and NAME are matched, we think it's deepin/uos.

Log:
  • Loading branch information
kamiyadm committed Nov 9, 2023
1 parent 4325cfb commit c6f5d4e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
11 changes: 7 additions & 4 deletions debian/linglong-bin.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ configure)

if [ -f /etc/os-release ]; then
VERSION=$(sed -ne '/^VERSION_ID=.*$/P' /etc/os-release | awk -F = '{print $2}' | sed -e 's/"//g' | awk -F . '{print $1}')
NAME=$(sed -ne '/^NAME=.*$/P' /etc/os-release | awk -F = '{print $2}' | sed -e 's/"//g' | awk -F . '{print $1}')
if [ -z "${VERSION}" ]; then
VERSION=0
fi
if [ ${VERSION} -eq 20 ]; then
LINGLONG_ROOT="/data/linglong"
elif [ ${VERSION} -eq 23 ]; then
LINGLONG_ROOT="/persistent/linglong"
if [[ "$NAME" == "UOS" || "$NAME" == "Deepin" || "$NAME" == "deepin" || "$NAME" == "uos" ]]; then
if [ ${VERSION} -eq 20 ]; then
LINGLONG_ROOT="/data/linglong"
elif [ ${VERSION} -eq 23 ]; then
LINGLONG_ROOT="/persistent/linglong"
fi
fi
fi

Expand Down
13 changes: 7 additions & 6 deletions scripts/61-linglong
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ VERSION=0

if [ -f /etc/os-release ]; then
VERSION=$(sed -ne '/^VERSION_ID=.*$/P' /etc/os-release | awk -F = '{print $2}' | sed -e 's/"//g' | awk -F . '{print $1}')

NAME=$(sed -ne '/^NAME=.*$/P' /etc/os-release | awk -F = '{print $2}' | sed -e 's/"//g' | awk -F . '{print $1}')
if [ -z "${VERSION}" ]; then
VERSION=0
fi

if [ ${VERSION} -eq 20 ]; then
LINGLONG_ROOT="/data/linglong"
elif [ ${VERSION} -eq 23 ]; then
LINGLONG_ROOT="/persistent/linglong"
if [[ "$NAME" == "UOS" || "$NAME" == "Deepin" || "$NAME" == "deepin" || "$NAME" == "uos" ]]; then
if [ ${VERSION} -eq 20 ]; then
LINGLONG_ROOT="/data/linglong"
elif [ ${VERSION} -eq 23 ]; then
LINGLONG_ROOT="/persistent/linglong"
fi
fi
fi

Expand Down
11 changes: 7 additions & 4 deletions scripts/linglong.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ VERSION=0

if [ -f /etc/os-release ]; then
VERSION=$(sed -ne '/^VERSION_ID=.*$/P' /etc/os-release | awk -F = '{print $2}' | sed -e 's/"//g' | awk -F . '{print $1}')
NAME=$(sed -ne '/^NAME=.*$/P' /etc/os-release | awk -F = '{print $2}' | sed -e 's/"//g' | awk -F . '{print $1}')
if [ -z "${VERSION}" ]; then
VERSION=0
fi
if [ ${VERSION} -eq 20 ]; then
LINGLONG_ROOT="/data/linglong"
elif [ ${VERSION} -eq 23 ]; then
LINGLONG_ROOT="/persistent/linglong"
if [ "$NAME" == "UOS" ] || [ "$NAME" == "Deepin" ] || [ "$NAME" == "deepin" ] || [ "$NAME" == "uos" ]; then
if [ ${VERSION} -eq 20 ]; then
LINGLONG_ROOT="/data/linglong"
elif [ ${VERSION} -eq 23 ]; then
LINGLONG_ROOT="/persistent/linglong"
fi
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion src/module/runtime/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class AppPrivate
// 获取环境变量LINGLONG_ROOT
auto linglongRootPath = envMap.contains(QString("LINGLONG_ROOT"))
? envMap[QString("LINGLONG_ROOT")]
: QString("/persistent/linglong");
: QString("/var/lib/linglong");
QMap<QString, QString> variables = {
{ "APP_ROOT_PATH", appRootPath },
{ "RUNTIME_ROOT_PATH", runtimeRootPath },
Expand Down
2 changes: 1 addition & 1 deletion src/package_manager/impl/package_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ bool PackageManagerPrivate::checkAppBase(const QString &runtime,
return false;
}

auto runtimeInfo = appList.at(0);
auto runtimeInfo = appList.last();
auto baseRef = runtimeInfo->runtime;
QStringList baseList = baseRef.split('/');
if (baseList.size() < 3) {
Expand Down

0 comments on commit c6f5d4e

Please sign in to comment.