You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.7 KiB
53 lines
1.7 KiB
<?php
|
|
|
|
namespace package_managers;
|
|
|
|
class apk {
|
|
|
|
public static function is_installed($prog) {
|
|
exec(\neato::get_user_bin . 'apk -e info ' . safeCmd($prog), $out, $exit_code);
|
|
return ($exit_code == 0) ? ['installed' => true, 'version' => $out] : ['installed' => false];
|
|
}
|
|
|
|
public static function upgrade($prog) {
|
|
exec(\neato::get_user_bin . 'apk upgrade -y ' . safeCmdQuotes($prog) . stdErr(), $output, $exit_code);
|
|
display($output);
|
|
checkForError($exit_code, "Unable to upgrade: {$prog}");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function install($prog) {
|
|
exec(\neato::get_user_bin . 'apk add -y ' . safeCmdQuotes($prog) . stdErr(), $output, $exit_code);
|
|
display($output);
|
|
checkForError($exit_code, "Unable to install: {$prog}");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function uninstall($prog) {
|
|
exec(\neato::get_user_bin . 'apk del -y ' . safeCmdQuotes($prog) . stdErr(), $output, $exit_code);
|
|
display($output);
|
|
checkForError($exit_code, "Unable to uninstall: {$prog}");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function add_repo($repo) {
|
|
exec("echo \"$repo\" >> /etc/apk/repositories");
|
|
exec(\neato::get_user_bin . 'apk update' . stdErr(), $output, $exit_code);
|
|
display($output);
|
|
checkForError($exit_code, "Unable to add new repo: {$repo}");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function update() {
|
|
exec(\neato::get_user_bin . 'apk update -y ' . stdErr(), $output, $exit_code);
|
|
display($output);
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function full_update() {
|
|
exec(\neato::get_user_bin . 'apk update -y && ' . \neato::get_user_bin . 'apk upgrade -y' . stdErr(), $output, $exit_code);
|
|
display($output);
|
|
return $exit_code;
|
|
}
|
|
|
|
}
|