@@ -464,18 +464,6 @@ int Cli::run([[maybe_unused]] CLI::App *subcommand)
464
464
return -1 ;
465
465
}
466
466
467
- // NOTE: this is for the new behavior of 'll-cli install xxx.uab'.
468
- // old behavior: install->installFromFile->PM
469
- // new behavior: install->installFromFile->(Execute xxx.uab)->install->installFromFile->PM
470
- // We want to let uab check itself once by executing it. But executing uab will cause it to run
471
- // directly. So we use an environment variable to skip the running step. Another implementation
472
- // is to add other parameters to uab.
473
- auto skipRunning = qgetenv (" LINGLONG_UAB_SKIP_RUNNING" );
474
- if (!skipRunning.isEmpty ()) {
475
- qDebug () << " LINGLONG_UAB_SKIP_RUNNING is set, skip running" ;
476
- return 0 ;
477
- }
478
-
479
467
auto userContainerDir = std::filesystem::path{ " /run/linglong" } / std::to_string (::getuid ());
480
468
if (auto ret = ensureDirectory (userContainerDir); !ret) {
481
469
this ->printer .printErr (ret.error ());
@@ -997,53 +985,11 @@ void Cli::cancelCurrentTask()
997
985
}
998
986
}
999
987
1000
- bool isUAB (const QString &file)
1001
- {
1002
- return file.endsWith (" .uab" );
1003
- }
1004
-
1005
988
int Cli::installFromFile (const QFileInfo &fileInfo, const api::types::v1::CommonOptions &options)
1006
989
{
1007
990
auto filePath = fileInfo.absoluteFilePath ();
1008
991
LINGLONG_TRACE (QString{ " install from file %1" }.arg (filePath));
1009
992
1010
- #ifdef UAB_SPECIAL_INSTALL
1011
- if (fileInfo.suffix () == " uab" ) {
1012
- auto parent = getppid ();
1013
-
1014
- QFileInfo info (QString (" /proc/%1/exe" ).arg (parent));
1015
- auto parentBin = info.symLinkTarget ();
1016
- if (!isUAB (parentBin)) {
1017
- qDebug () << " The parent" << parentBin << " is not UAB." ;
1018
- auto newParentBin = fileInfo.absoluteFilePath ();
1019
- char *argv[] = { newParentBin.toLocal8Bit ().data (), NULL };
1020
-
1021
- QProcessEnvironment sysEnv = QProcessEnvironment::systemEnvironment ();
1022
- QStringList envList = sysEnv.toStringList ();
1023
-
1024
- auto targetEnvc = envList.size ();
1025
- std::vector<const char *> targetEnvv;
1026
-
1027
- for (int i = 0 ; i < targetEnvc; i++) {
1028
- targetEnvv.push_back (envList.at (i).toLocal8Bit ().constData ());
1029
- }
1030
- targetEnvv.push_back (" LINGLONG_UAB_SKIP_RUNNING=true" );
1031
- targetEnvv.push_back (nullptr );
1032
-
1033
- auto ret = ::execve (newParentBin.toLocal8Bit ().constData (),
1034
- argv,
1035
- const_cast <char **>(targetEnvv.data ()));
1036
- if (ret < 0 ) {
1037
- this ->printer .printErr (
1038
- LINGLONG_ERRV (QString (" execve %1 failed, errno: %2" )
1039
- .arg (newParentBin, QString::fromStdString (::strerror (errno)))));
1040
- return ret;
1041
- }
1042
- }
1043
- qDebug () << " The parent is UAB:" << parentBin;
1044
- }
1045
- #endif
1046
-
1047
993
QDBusReply<QString> authReply = this ->authorization ();
1048
994
if (!authReply.isValid () && authReply.error ().type () == QDBusError::AccessDenied) {
1049
995
auto args = QCoreApplication::instance ()->arguments ();
0 commit comments