mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-04-29 14:59:50 +00:00
Gugelhupf
This commit is contained in:
parent
5911833235
commit
9452c125fe
15 changed files with 475 additions and 8 deletions
|
|
@ -14,10 +14,16 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.BaseAdapter;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
|
@ -27,10 +33,18 @@ import androidx.core.graphics.Insets;
|
|||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.vectras.qemu.MainSettingsManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class Minitools extends AppCompatActivity {
|
||||
|
||||
private ArrayList<HashMap<String, String>> listmapForSelectMirrors = new ArrayList<>();
|
||||
private Spinner spinnerselectmirror;
|
||||
private String selectedMirrorCommand = "";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
@ -54,6 +68,7 @@ public class Minitools extends AppCompatActivity {
|
|||
LinearLayout deleteallvm = findViewById(R.id.deleteallvm);
|
||||
LinearLayout reinstallsystem = findViewById(R.id.reinstallsystem);
|
||||
LinearLayout deleteall = findViewById(R.id.deleteall);
|
||||
spinnerselectmirror = findViewById(R.id.spinnerselectmirror);
|
||||
|
||||
setupsoundfortermux.setOnClickListener(v -> {
|
||||
if (VectrasApp.isAppInstalled("com.termux", getApplicationContext())) {
|
||||
|
|
@ -219,6 +234,22 @@ public class Minitools extends AppCompatActivity {
|
|||
});
|
||||
alertDialog.show();
|
||||
});
|
||||
|
||||
spinnerselectmirror.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
selectedMirrorCommand = listmapForSelectMirrors.get(position).get("mirror");
|
||||
MainSettingsManager.setSelectedMirror(Minitools.this, position);
|
||||
VectrasApp.runACommand(selectedMirrorCommand + "&& exit", Minitools.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
setupSpiner();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -233,4 +264,50 @@ public class Minitools extends AppCompatActivity {
|
|||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void setupSpiner() {
|
||||
VectrasApp.setupMirrorListForListmap(listmapForSelectMirrors);
|
||||
|
||||
spinnerselectmirror.setAdapter(new SpinnerSelectMirrorAdapter(listmapForSelectMirrors));
|
||||
spinnerselectmirror.setSelection(MainSettingsManager.getSelectedMirror(Minitools.this));
|
||||
}
|
||||
|
||||
public class SpinnerSelectMirrorAdapter extends BaseAdapter {
|
||||
|
||||
ArrayList<HashMap<String, String>> _data;
|
||||
|
||||
public SpinnerSelectMirrorAdapter(ArrayList<HashMap<String, String>> _arr) {
|
||||
_data = _arr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return _data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, String> getItem(int _index) {
|
||||
return _data.get(_index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int _index) {
|
||||
return _index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int _position, View _v, ViewGroup _container) {
|
||||
LayoutInflater _inflater = getLayoutInflater();
|
||||
View _view = _v;
|
||||
if (_view == null) {
|
||||
_view = _inflater.inflate(R.layout.simple_layout_for_spiner, null);
|
||||
}
|
||||
|
||||
final TextView textViewLocation = _view.findViewById(R.id.textViewLocation);
|
||||
|
||||
textViewLocation.setText(_data.get((int) _position).get("location"));
|
||||
|
||||
return _view;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -21,14 +21,20 @@ import android.os.Bundle;
|
|||
import android.os.Environment;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.Settings;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.Manifest;
|
||||
import android.widget.BaseAdapter;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
|
@ -56,7 +62,9 @@ import java.io.OutputStream;
|
|||
import java.io.OutputStreamWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
public class SetupQemuActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
Activity activity;
|
||||
|
|
@ -80,6 +88,7 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
MaterialButton buttonsetupshowlog;
|
||||
TextView textviewshowadvancedsetup;
|
||||
TextView textviewhideadvancedsetup;
|
||||
Spinner spinnerselectmirror;
|
||||
|
||||
AlertDialog alertDialog;
|
||||
private boolean settingup = false;
|
||||
|
|
@ -90,6 +99,9 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
private String contentJSON = "";
|
||||
private HashMap<String, Object> mmap = new HashMap<>();
|
||||
private String bootstrapfilelink = "";
|
||||
private ArrayList<HashMap<String, String>> listmapForSelectMirrors = new ArrayList<>();
|
||||
private String selectedMirrorCommand = "";
|
||||
private String selectedMirrorLocation = "";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
|
@ -111,6 +123,7 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
buttonsetupshowlog = findViewById(R.id.buttonsetupshowlog);
|
||||
textviewshowadvancedsetup = findViewById(R.id.textviewshowadvancedsetup);
|
||||
textviewhideadvancedsetup = findViewById(R.id.textviewhideadvancedsetup);
|
||||
spinnerselectmirror = findViewById(R.id.spinnerselectmirror);
|
||||
|
||||
buttontryconnectagain.setOnClickListener(this);
|
||||
buttonautosetup.setOnClickListener(this);
|
||||
|
|
@ -127,10 +140,25 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
inBtn = findViewById(R.id.btnInstall);
|
||||
title = findViewById(R.id.title);
|
||||
inBtn.setOnClickListener(this);
|
||||
setupSpiner();
|
||||
|
||||
tarPath = getExternalFilesDir("data") + "/data.tar.gz";
|
||||
VectrasApp.prepareDataForAppConfig(activity);
|
||||
|
||||
spinnerselectmirror.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
selectedMirrorCommand = Objects.requireNonNull(listmapForSelectMirrors.get(position).get("mirror"));
|
||||
selectedMirrorLocation = Objects.requireNonNull(listmapForSelectMirrors.get(position).get("location"));
|
||||
MainSettingsManager.setSelectedMirror(activity, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
net = new RequestNetwork(this);
|
||||
_net_request_listener = new RequestNetwork.RequestListener() {
|
||||
@Override
|
||||
|
|
@ -354,6 +382,9 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
if (textToAdd.contains("Starting setup...")) {
|
||||
title.setText("Getting ready for you...");
|
||||
textviewsettingup.setText(R.string.getting_ready_for_you_please_don_t_disconnect_the_network);
|
||||
} else if (textToAdd.contains("fetch http")) {
|
||||
title.setText(getString(R.string.connecting_to_mirror_in) + "\n" + selectedMirrorLocation + "...");
|
||||
textviewsettingup.setText(getString(R.string.connecting_to_mirror_in) + "\n" + selectedMirrorLocation + "...");
|
||||
} else if (textToAdd.contains("Installing packages...")) {
|
||||
title.setText(R.string.it_won_t_take_long);
|
||||
textviewsettingup.setText(R.string.completed_10_it_won_t_take_long);
|
||||
|
|
@ -623,7 +654,7 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
progressBar.setVisibility(View.VISIBLE);
|
||||
String filesDir = activity.getFilesDir().getAbsolutePath();
|
||||
String cmd = "";
|
||||
cmd += "echo \"https://dl-cdn.alpinelinux.org/alpine/edge/testing\" | tee -a /etc/apk/repositories;";
|
||||
cmd += selectedMirrorCommand + ";";
|
||||
executeShellCommand(cmd);
|
||||
executeShellCommand("set -e;" +
|
||||
" echo \"Starting setup...\";" +
|
||||
|
|
@ -645,7 +676,7 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
progressBar.setVisibility(View.VISIBLE);
|
||||
String filesDir = activity.getFilesDir().getAbsolutePath();
|
||||
String cmd = "";
|
||||
cmd += "echo \"https://dl-cdn.alpinelinux.org/alpine/edge/testing\" | tee -a /etc/apk/repositories;";
|
||||
cmd += selectedMirrorCommand + ";";
|
||||
executeShellCommand(cmd);
|
||||
executeShellCommand("set -e;" +
|
||||
" echo \"Starting setup...\";" +
|
||||
|
|
@ -667,7 +698,7 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
progressBar.setVisibility(View.VISIBLE);
|
||||
String filesDir = activity.getFilesDir().getAbsolutePath();
|
||||
String cmd = "";
|
||||
cmd += "echo \"https://dl-cdn.alpinelinux.org/alpine/edge/testing\" | tee -a /etc/apk/repositories;";
|
||||
cmd += selectedMirrorCommand + ";";
|
||||
executeShellCommand(cmd);
|
||||
executeShellCommand("set -e;" +
|
||||
" echo \"Starting setup...\";" +
|
||||
|
|
@ -832,4 +863,50 @@ public class SetupQemuActivity extends AppCompatActivity implements View.OnClick
|
|||
alertDialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
private void setupSpiner() {
|
||||
VectrasApp.setupMirrorListForListmap(listmapForSelectMirrors);
|
||||
|
||||
spinnerselectmirror.setAdapter(new SpinnerSelectMirrorAdapter(listmapForSelectMirrors));
|
||||
spinnerselectmirror.setSelection(MainSettingsManager.getSelectedMirror(activity));
|
||||
}
|
||||
|
||||
public class SpinnerSelectMirrorAdapter extends BaseAdapter {
|
||||
|
||||
ArrayList<HashMap<String, String>> _data;
|
||||
|
||||
public SpinnerSelectMirrorAdapter(ArrayList<HashMap<String, String>> _arr) {
|
||||
_data = _arr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return _data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, String> getItem(int _index) {
|
||||
return _data.get(_index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int _index) {
|
||||
return _index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int _position, View _v, ViewGroup _container) {
|
||||
LayoutInflater _inflater = getLayoutInflater();
|
||||
View _view = _v;
|
||||
if (_view == null) {
|
||||
_view = _inflater.inflate(R.layout.simple_layout_for_spiner, null);
|
||||
}
|
||||
|
||||
final TextView textViewLocation = _view.findViewById(R.id.textViewLocation);
|
||||
|
||||
textViewLocation.setText(Objects.requireNonNull(_data.get((int) _position).get("location")));
|
||||
|
||||
return _view;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -614,6 +614,11 @@ public class VectrasApp extends Application {
|
|||
}
|
||||
}
|
||||
|
||||
public static void runACommand(String _command, Activity _activity) {
|
||||
Terminal vterm = new Terminal(_activity);
|
||||
vterm.executeShellCommand2(_command, false, _activity);
|
||||
}
|
||||
|
||||
public static void killallqemuprocesses(Context context) {
|
||||
Terminal vterm = new Terminal(context);
|
||||
vterm.executeShellCommand2("killall -9 qemu-system-i386", false, MainActivity.activity);
|
||||
|
|
@ -762,4 +767,200 @@ public class VectrasApp extends Application {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setupMirrorListForListmap(ArrayList<HashMap<String, String>> listmapForSelectMirrors) {
|
||||
HashMap<String, String> mapForAddItems = new HashMap<>();
|
||||
|
||||
mapForAddItems.put("location", "United States (Default)");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true, "dl-cdn.alpinelinux.org", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Australia");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(false,"mirror.aarnet.edu.au", "/pub/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Austria");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirror.alwyzon.net", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Bulgaria");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirrors.neterra.net", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Brazil");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirror.uepg.br", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Cambodia");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirror.sabay.com.kh", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Canada");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true, "mirror.csclub.uwaterloo.ca", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Chile");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"elmirror.cl", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "China");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true, "mirrors.tuna.tsinghua.edu.cn", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Czech Republic");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true, "mirror.fel.cvut.cz", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Denmark");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true, "mirrors.dotsrc.org", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Finland");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true, "mirror.5i.fi", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "France");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirrors.ircam.fr", "/pub/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Germany");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"ftp.halifax.rwth-aachen.de", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Hong Kong");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true, "mirror.xtom.com.hk", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Indonesia");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(false,"foobar.turbo.net.id", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Iran");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirror.bardia.tech", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Italy");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"alpinelinux.mirror.garr.it", ""));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Japan");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true, "repo.jing.rocks", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Kazakhstan");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirror.ps.kz", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Moldova");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirror.ihost.md", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Morocco");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true, "mirror.marwan.ma", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "New Caledonia");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirror.lagoon.nc", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "New Zealand");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirror.2degrees.nz", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Poland");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"ftp.icm.edu.pl", "/pub/Linux/distributions/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Portugal");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirror.leitecastro.com", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Romania");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirrors.hosterion.ro", "/alpinelinux"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Russia");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirror.hyperdedic.ru", "/alpinelinux"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Singapore");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirror.jingk.ai", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Slovenia");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirror.tux.si", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Spain");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirror.raiolanetworks.com", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Sweden");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true, "ftp.lysator.liu.se/pub", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Switzerland");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true, "pkg.adfinis.com", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Taiwan");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true, "mirror.twds.com.tw", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "Thailand");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"mirror.kku.ac.th", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "The Netherlands");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"alpine.mirror.wearetriple.com", ""));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
|
||||
mapForAddItems = new HashMap<>();
|
||||
mapForAddItems.put("location", "United Kingdom");
|
||||
mapForAddItems.put("mirror", createCommandForSelectedMirror(true,"uk.alpinelinux.org", "/alpine"));
|
||||
listmapForSelectMirrors.add(mapForAddItems);
|
||||
}
|
||||
|
||||
public static String createCommandForSelectedMirror(boolean _https, String _url, String _beforemain) {
|
||||
String command = "echo \"\" > /etc/apk/repositories && sed -i -e \"1ihttps://xssFjnj58Id/yttGkok69Je/edge/testing\" /etc/apk/repositories && sed -i -e \"1ihttps://xssFjnj58Id/alpine/v3.19/community\" /etc/apk/repositories && sed -i -e \"1ihttps://xssFjnj58Id/alpine/v3.19/main\" /etc/apk/repositories";
|
||||
command = command.replaceAll("/yttGkok69Je", _beforemain);
|
||||
if (!_https)
|
||||
command = command.replaceAll("https://", "http://");
|
||||
return command.replaceAll("xssFjnj58Id", _url);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue