summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index d5157eb..f8513e4 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -36,117 +36,121 @@ using namespace std;
36Ipkg :: Ipkg() 36Ipkg :: Ipkg()
37{ 37{
38} 38}
39 39
40Ipkg :: ~Ipkg() 40Ipkg :: ~Ipkg()
41{ 41{
42} 42}
43 43
44// Option is what we are going to do - install, upgrade, download 44// Option is what we are going to do - install, upgrade, download
45// package is the package name to install - either a fully qualified path and ipk 45// package is the package name to install - either a fully qualified path and ipk
46// file (if stored locally) or just the name of the package (for a network package) 46// file (if stored locally) or just the name of the package (for a network package)
47// packageName is the package name - (for a network package this will be the same as 47// packageName is the package name - (for a network package this will be the same as
48// package parameter) 48// package parameter)
49// dest is the destination alias (from ipk.conf) 49// dest is the destination alias (from ipk.conf)
50// destDir is the dir that the destination alias points to (used to link to root) 50// destDir is the dir that the destination alias points to (used to link to root)
51// flags is the ipkg options flags 51// flags is the ipkg options flags
52// dir is the directory to run ipkg in (defaults to "") 52// dir is the directory to run ipkg in (defaults to "")
53bool Ipkg :: runIpkg( ) 53bool Ipkg :: runIpkg( )
54{ 54{
55 bool ret = false; 55 bool ret = false;
56 56
57 QDir::setCurrent( "/tmp" ); 57 QDir::setCurrent( "/tmp" );
58 QString cmd = ""; 58 QString cmd = "";
59 59
60 if ( runtimeDir != "" ) 60 if ( runtimeDir != "" )
61 { 61 {
62 cmd += "cd "; 62 cmd += "cd ";
63 cmd += runtimeDir; 63 cmd += runtimeDir;
64 cmd += " ; "; 64 cmd += " ; ";
65 } 65 }
66 cmd += "ipkg"; 66 cmd += "ipkg";
67 67
68 if ( option != "update" && option != "download" ) 68 if ( option != "update" && option != "download" && option != "upgrade" )
69 { 69 {
70 cmd += " -dest "+ destination; 70 cmd += " -dest "+ destination;
71 cmd += " -force-defaults"; 71 cmd += " -force-defaults";
72 72
73 if ( flags & FORCE_DEPENDS ) 73 if ( flags & FORCE_DEPENDS )
74 cmd += " -force-depends"; 74 cmd += " -force-depends";
75 if ( flags & FORCE_REINSTALL ) 75 if ( flags & FORCE_REINSTALL )
76 cmd += " -force-reinstall"; 76 cmd += " -force-reinstall";
77 if ( flags & FORCE_REMOVE ) 77 if ( flags & FORCE_REMOVE )
78 cmd += " -force-removal-of-essential-packages"; 78 cmd += " -force-removal-of-essential-packages";
79 if ( flags & FORCE_OVERWRITE ) 79 if ( flags & FORCE_OVERWRITE )
80 cmd += " -force-overwrite"; 80 cmd += " -force-overwrite";
81 81
82 // Handle make links 82 // Handle make links
83 // Rules - If make links is switched on, create links to root 83 // Rules - If make links is switched on, create links to root
84 // if destDir is NOT / 84 // if destDir is NOT /
85 if ( flags & MAKE_LINKS ) 85 if ( flags & MAKE_LINKS )
86 { 86 {
87 // If destDir == / turn off make links as package is being insalled 87 // If destDir == / turn off make links as package is being insalled
88 // to root already. 88 // to root already.
89 if ( destDir == "/" ) 89 if ( destDir == "/" )
90 flags ^= MAKE_LINKS; 90 flags ^= MAKE_LINKS;
91 } 91 }
92 92
93 } 93 }
94 94
95#ifdef X86 95#ifdef X86
96 cmd += " -f "; 96 cmd += " -f ";
97 cmd += IPKG_CONF; 97 cmd += IPKG_CONF;
98#endif 98#endif
99 99
100 cmd += " " + option + " " + package + " 2>&1"; 100 cmd += " " + option;
101 if ( option != "upgrade" )
102 cmd += " " + package;
103 cmd += " 2>&1";
101 104
102 qApp->processEvents(); 105 qApp->processEvents();
103 106
104 // If we are removing packages and make links option is selected 107 // If we are removing packages and make links option is selected
105 // create the links 108 // create the links
106 if ( option == "remove" ) 109 if ( option == "remove" )
107 { 110 {
108 createLinks = false; 111 createLinks = false;
109 if ( flags & MAKE_LINKS ) 112 if ( flags & MAKE_LINKS )
110 { 113 {
111 emit outputText( QString( "Removing symbolic links...\n" ) ); 114 emit outputText( QString( "Removing symbolic links...\n" ) );
112 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); 115 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
113 } 116 }
114 } 117 }
115 118
116 emit outputText( cmd ); 119 emit outputText( cmd );
117 120
118 // Execute command 121 // Execute command
119 dependantPackages = new QList<QString>; 122 dependantPackages = new QList<QString>;
120 dependantPackages->setAutoDelete( true ); 123 dependantPackages->setAutoDelete( true );
124
121 ret = executeIpkgCommand( cmd, option ); 125 ret = executeIpkgCommand( cmd, option );
122 126
123 if ( option == "install" ) 127 if ( option == "install" )
124 { 128 {
125 // If we are not removing packages and make links option is selected 129 // If we are not removing packages and make links option is selected
126 // create the links 130 // create the links
127 createLinks = true; 131 createLinks = true;
128 if ( flags & MAKE_LINKS ) 132 if ( flags & MAKE_LINKS )
129 { 133 {
130 emit outputText( " " ); 134 emit outputText( " " );
131 emit outputText( QString( "Creating symbolic links for " )+ package ); 135 emit outputText( QString( "Creating symbolic links for " )+ package );
132 136
133 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); 137 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
134 138
135 // link dependant packages that were installed with this release 139 // link dependant packages that were installed with this release
136 QString *pkg; 140 QString *pkg;
137 for ( pkg = dependantPackages->first(); pkg != 0; pkg = dependantPackages->next() ) 141 for ( pkg = dependantPackages->first(); pkg != 0; pkg = dependantPackages->next() )
138 { 142 {
139 emit outputText( " " ); 143 emit outputText( " " );
140 emit outputText( QString( "Creating symbolic links for " )+ (*pkg) ); 144 emit outputText( QString( "Creating symbolic links for " )+ (*pkg) );
141 linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir ); 145 linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir );
142 } 146 }
143 } 147 }
144 } 148 }
145 149
146 delete dependantPackages; 150 delete dependantPackages;
147 151
148 emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") ); 152 emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") );
149 return ret; 153 return ret;
150} 154}
151 155
152 156