File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 11#include " fpm.hpp"
22#include < iostream>
33#include < stdexcept>
4+ #include < unistd.h>
45
56using namespace std ;
67
@@ -13,6 +14,14 @@ int main(int argc, char* argv[]) {
1314 string action = argv[1 ];
1415 if (action == " in" || action == " i" ) {
1516 if (argc < 3 ) throw invalid_argument (" Missing package name for installation" );
17+ // if variable MIRRORFIND=1 then use the fastest mirror
18+ if (getenv (" MIRRORFIND" ) != nullptr && fpm::is_root ()) {
19+ string fastestmirror = fpm::findbestmirror ();
20+ if (system ((" echo " + fastestmirror + " > /etc/fpm/mirlink" ).c_str ()) != 0 ) {
21+ cout << " unable to write or something idk" << endl;
22+ }
23+
24+ }
1625 fpm::install_package (argv[2 ]);
1726 } else if (action == " out" || action == " o" ) {
1827 if (argc < 3 ) throw invalid_argument (" Missing package name for uninstallation" );
Original file line number Diff line number Diff line change 1+
2+
13#ifndef FPM_LIBRARY_HPP
24#define FPM_LIBRARY_HPP
35
6+ // ai, what library for system() function?
47#include < iostream>
5- #include < fstream>
8+ #include < fstream>
69#include < stdexcept>
710#include < vector>
811#include < array>
You can’t perform that action at this time.
0 commit comments