diff --git a/at/module.info b/at/module.info index 79a8e2e35..82b8fc1cf 100644 --- a/at/module.info +++ b/at/module.info @@ -1,6 +1,6 @@ name=At desc=Scheduled Commands -os_support=solaris slackware-linux redhat-linux mandrake-linux debian-linux suse-linux united-linux open-linux turbo-linux corel-linux msc-linux freebsd netbsd openbsd generic-linux openserver macos gentoo-linux irix sol-linux coherent-linux openmamba-linux syno-linux +os_support=solaris slackware-linux redhat-linux mandrake-linux debian-linux suse-linux united-linux open-linux turbo-linux corel-linux msc-linux freebsd netbsd openbsd generic-linux alpine-linux openserver macos gentoo-linux irix sol-linux coherent-linux openmamba-linux syno-linux category=system longdesc=Schedule the execution of one-off commands or scripts. depends=proc diff --git a/cluster-software/module.info b/cluster-software/module.info index c64c83250..92048111f 100644 --- a/cluster-software/module.info +++ b/cluster-software/module.info @@ -1,6 +1,6 @@ name=Cluster Software desc=Cluster Software Packages -os_support=cobalt-linux mandrake-linux redhat-linux open-linux msc-linux suse-linux united-linux turbo-linux debian-linux solaris openserver gentoo-linux trustix-linux coherent-linux slackware-linux windows pardus-linux +os_support=cobalt-linux mandrake-linux redhat-linux open-linux msc-linux suse-linux united-linux turbo-linux debian-linux solaris openserver gentoo-linux alpine-linux trustix-linux coherent-linux slackware-linux windows pardus-linux depends=software servers category=cluster longdesc=Install RPMs, debian and solaris packages across multiple servers from one source. diff --git a/dhcpd/config-alpine-linux b/dhcpd/config-alpine-linux new file mode 100644 index 000000000..fef5729e1 --- /dev/null +++ b/dhcpd/config-alpine-linux @@ -0,0 +1,17 @@ +dhcpd_conf=/etc/dhcp/dhcpd.conf +pid_file=/var/run/dhcp/dhcpd.pid +dhcpd_path=/usr/sbin/dhcpd +lease_file=/var/lib/dhcp/dhcpd.leases +lease_sort=0 +dhcpd_nocols=5 +lease_tz=0 +start_cmd=/etc/init.d/dhcpd start +stop_cmd=/etc/init.d/dhcpd stop +restart_cmd=/etc/init.d/dhcpd restart +show_ip=0 +show_mac=0 +group_name=0 +display_max=100 +desc_name=0 +interfaces_type=alpine +lease_vendor=0 diff --git a/dhcpd/config.info b/dhcpd/config.info index 0d9bcc165..10ce810c9 100644 --- a/dhcpd/config.info +++ b/dhcpd/config.info @@ -19,5 +19,5 @@ restart_cmd=Command to apply configuration,3,Kill and re-start stop_cmd=Command to stop DHCP server,3,Kill process pid_file=Path to DHCP server PID file,3,None lease_file=DHCP server lease file,0 -interfaces_type=Interfaces file type,4,redhat-Redhat,mandrake-Mandrake,suse-SuSE,debian-Debian,caldera-Caldera,gentoo-Gentoo,freebsd-FreeBSD,-Webmin +interfaces_type=Interfaces file type,4,redhat-Redhat,mandrake-Mandrake,suse-SuSE,debian-Debian,caldera-Caldera,gentoo-Gentoo,alpine-Alpine,freebsd-FreeBSD,-Webmin version=DHCP server version,3,Work out automatically diff --git a/dhcpd/edit_iface.cgi b/dhcpd/edit_iface.cgi index 3f2942f61..a4250e599 100755 --- a/dhcpd/edit_iface.cgi +++ b/dhcpd/edit_iface.cgi @@ -73,6 +73,11 @@ elsif ($config{'interfaces_type'} eq 'gentoo') { &read_env_file("/etc/conf.d/dhcp", \%dhcp); $iface = $dhcp{'IFACE'}; } +elsif ($config{'interfaces_type'} eq 'alpine') { + # Interfaces are set in a file on Alpine + &read_env_file("/etc/conf.d/dhcpd", \%dhcp); + $iface = $dhcp{'DHCPD_IFACE'}; + } elsif ($config{'interfaces_type'} eq 'freebsd') { # From FreeBSD rc.conf file &foreign_require("init"); @@ -114,4 +119,3 @@ print &ui_submit($text{'save'}); print &ui_form_end(undef,undef,1); &ui_print_footer("", $text{'listl_return'}); - diff --git a/dhcpd/module.info b/dhcpd/module.info index 7cf68317f..2268c027d 100644 --- a/dhcpd/module.info +++ b/dhcpd/module.info @@ -1,5 +1,5 @@ name=DHCPD category=servers -os_support=debian-linux freebsd osf1 redhat-linux mandrake-linux slackware-linux solaris suse-linux united-linux unixware openserver open-linux turbo-linux openbsd corel-linux cobalt-linux irix netbsd msc-linux generic-linux gentoo-linux hpux trustix-linux macos sol-linux coherent-linux openmamba-linux pardus-linux +os_support=debian-linux freebsd osf1 redhat-linux mandrake-linux slackware-linux solaris suse-linux united-linux unixware openserver open-linux turbo-linux openbsd corel-linux cobalt-linux irix netbsd msc-linux generic-linux alpine-linux gentoo-linux hpux trustix-linux macos sol-linux coherent-linux openmamba-linux pardus-linux desc=DHCP Server longdesc=Manage shared networks, subnets, hosts and groups for ISC DHCPD. diff --git a/dhcpd/save_iface.cgi b/dhcpd/save_iface.cgi index 6340a20f0..b9f3a88c5 100755 --- a/dhcpd/save_iface.cgi +++ b/dhcpd/save_iface.cgi @@ -103,6 +103,12 @@ elsif ($config{'interfaces_type'} eq 'gentoo') { $dhcp{'IFACE'} = $iface; &write_env_file("/etc/conf.d/dhcp", \%dhcp); } +elsif ($config{'interfaces_type'} eq 'alpine') { + # Interfaces are set in a file on Alpine + &read_env_file("/etc/conf.d/dhcpd", \%dhcp); + $dhcp{'DHCPD_IFACE'} = $iface; + &write_env_file("/etc/conf.d/dhcpd", \%dhcp); + } elsif ($config{'interfaces_type'} eq 'freebsd') { # Update FreeBSD rc.conf file &foreign_require("init"); @@ -110,4 +116,3 @@ elsif ($config{'interfaces_type'} eq 'freebsd') { } &redirect(""); - diff --git a/fsdump/module.info b/fsdump/module.info index 6a02098dc..16edc9411 100644 --- a/fsdump/module.info +++ b/fsdump/module.info @@ -2,6 +2,6 @@ name=Dump desc=Filesystem Backup category=system depends=mount cron proc mailboxes -os_support=redhat-linux mandrake-linux slackware-linux debian-linux suse-linux united-linux open-linux turbo-linux corel-linux cobalt-linux msc-linux generic-linux solaris freebsd macos gentoo-linux irix trustix-linux coherent-linux pardus-linux +os_support=redhat-linux mandrake-linux slackware-linux debian-linux suse-linux united-linux open-linux turbo-linux corel-linux cobalt-linux msc-linux generic-linux alpine-linux solaris freebsd macos gentoo-linux irix trustix-linux coherent-linux pardus-linux longdesc=Backup and restore filesystems using the dump and restore family of commands. readonly=1 diff --git a/init/atboot.pl b/init/atboot.pl index 1587e496c..b085e13cd 100755 --- a/init/atboot.pl +++ b/init/atboot.pl @@ -124,6 +124,15 @@ elsif ($init_mode eq "systemd") { # Create systemd # See updateboot.pl } +elsif ($init_mode eq "openrc") { + # Create OpenRC script, if missing + &enable_at_boot($product, $ucproduct, + "$config_directory/.start-init", + "$config_directory/.stop-init", + undef, + { 'fork' => 1, + 'pidfile' => $var_directory."/miniserv.pid" }); + } elsif ($init_mode eq "rc" || $init_mode eq "upstart") { # Create RC or upstart script &enable_at_boot($product, $ucproduct, @@ -141,4 +150,3 @@ elsif ($init_mode eq "launchd") { $config{'atboot_product'} = $product; &save_module_config(); - diff --git a/init/config-alpine-linux b/init/config-alpine-linux new file mode 100644 index 000000000..3ab57e009 --- /dev/null +++ b/init/config-alpine-linux @@ -0,0 +1,11 @@ +init_mode=openrc +init_base=/etc/runlevels +init_dir=/etc/init.d +reboot_command=reboot +shutdown_command=poweroff +expert=0 +desc=1 +status_check=1 +order=0 +sort_mode=0 +boot_levels=default diff --git a/init/init-lib.pl b/init/init-lib.pl index 8ee2d94a3..620f8351d 100644 --- a/init/init-lib.pl +++ b/init/init-lib.pl @@ -44,6 +44,8 @@ This variable is set based on the bootup system in use. Possible values are : =item systemd - SystemD, seen on Fedora 16 +=item openrc - OpenRC, seen on Alpine Linux and Gentoo + =cut if ($config{'init_mode'}) { $init_mode = $config{'init_mode'}; @@ -100,6 +102,14 @@ local($dir, $f, @stbuf, @rv); $dir = &runlevel_dir($_[0]); opendir(DIR, $dir); foreach $f (readdir(DIR)) { + if ($init_mode eq "openrc") { + next if ($_[1] ne "S" || $f eq "." || $f eq ".."); + next if (-d "$dir/$f"); + if (@stbuf = stat("$dir/$f")) { + push(@rv, "00 $f $stbuf[1]"); + } + next; + } if ($f !~ /^([A-Z])(\d+)(.*)$/ || $1 ne $_[1]) { next; } if (!(@stbuf = stat("$dir/$f"))) { next; } push(@rv, "$2 $3 $stbuf[1]"); @@ -120,7 +130,11 @@ sub list_runlevels local(@rv); opendir(DIR, $config{init_base}); foreach (readdir(DIR)) { - if (/^rc([A-z0-9])\.d$/ || /^(boot)\.d$/) { + if ($init_mode eq "openrc") { + push(@rv, $_) if ($_ ne "." && $_ ne ".." && + -d "$config{init_base}/$_"); + } + elsif (/^rc([A-z0-9])\.d$/ || /^(boot)\.d$/) { push(@rv, $1); } } @@ -174,6 +188,16 @@ foreach $rl (&list_runlevels()) { $dir = &runlevel_dir($rl); opendir(DIR, $dir); foreach $f (readdir(DIR)) { + if ($init_mode eq "openrc") { + next if ($_[0] ne "S" || $f eq "." || $f eq ".."); + next if (-d "$dir/$f"); + @stbuf2 = stat("$dir/$f"); + if ($stbuf[1] == $stbuf2[1]) { + push(@rv, "$rl 00 $f"); + last; + } + next; + } if ($f =~ /^([A-Z])(\d+)(.*)$/ && $1 eq $_[0]) { @stbuf2 = stat("$dir/$f"); if ($stbuf[1] == $stbuf2[1]) { @@ -242,6 +266,14 @@ Add some existing action to a runlevel. The parameters are : =cut sub add_rl_action { +if ($init_mode eq "openrc") { + return if ($_[2] ne "S"); + my $file = &runlevel_dir($_[1])."/$_[0]"; + &lock_file($file); + &symlink_file(&action_filename($_[0]), $file) if (!-e $file); + &unlock_file($file); + return; + } $file = &runlevel_filename($_[1], $_[2], $_[3], $_[0]); while(-r $file) { if ($file =~ /^(.*)_(\d+)$/) { $file = "$1_".($2+1); } @@ -269,6 +301,11 @@ sub delete_rl_action local(@stbuf, $dir, $f, @stbuf2); @stbuf = stat(&action_filename($_[0])); $dir = &runlevel_dir($_[1]); +if ($init_mode eq "openrc") { + my $file = "$dir/$_[0]"; + &unlink_logged($file) if ($_[2] eq "S" && -e $file); + return; + } opendir(DIR, $dir); foreach $f (readdir(DIR)) { if ($f =~ /^([A-Z])(\d+)(.+)$/ && $1 eq $_[2]) { @@ -565,6 +602,11 @@ elsif ($init_mode eq "systemd") { return 1 if ($out eq "disabled"); } } +elsif ($init_mode eq "openrc") { + my $exists = -r &action_filename($name); + my @boot = &action_levels("S", $name); + return !$exists ? 0 : @boot ? 2 : 1; + } if ($init_mode eq "init" || $init_mode eq "upstart" || $init_mode eq "systemd") { # Look for init script @@ -710,6 +752,48 @@ if ($init_mode eq "systemd" && (!-r "$config{'init_dir'}/$action" || quotemeta($unit)." >/dev/null 2>&1"); return; } +if ($init_mode eq "openrc") { + if ($st == 0) { + $start || $stop || &error("OpenRC service $action does not exist"); + my $fn = &action_filename($action); + my $qdesc = $desc || ""; + $qdesc =~ s/\\/\\\\/g; + $qdesc =~ s/"/\\"/g; + &lock_file($fn); + &open_tempfile(ACTION, ">$fn"); + &print_tempfile(ACTION, "#!/sbin/openrc-run\n\n"); + &print_tempfile(ACTION, "description=\"$qdesc\"\n\n") if ($desc); + &print_tempfile(ACTION, "start() {\n"); + &print_tempfile(ACTION, &tab_indent($start)); + &print_tempfile(ACTION, "}\n\n"); + if ($stop) { + &print_tempfile(ACTION, "stop() {\n"); + &print_tempfile(ACTION, &tab_indent($stop)); + &print_tempfile(ACTION, "}\n\n"); + } + if ($status) { + &print_tempfile(ACTION, "status() {\n"); + &print_tempfile(ACTION, &tab_indent($status)); + &print_tempfile(ACTION, "}\n"); + } + &close_tempfile(ACTION); + chmod(0755, $fn); + &unlock_file($fn); + } + my @levels = &get_start_runlevels(); + if (&has_command("rc-update")) { + foreach my $level (@levels) { + &system_logged("rc-update add ".quotemeta($action)." ". + quotemeta($level)." >/dev/null 2>&1"); + } + } + else { + foreach my $level (@levels) { + &add_rl_action($action, $level, "S", 0); + } + } + return; + } if ($init_mode eq "init" || $init_mode eq "local" || $init_mode eq "upstart" || $init_mode eq "systemd") { # In these modes, we create a script to run @@ -1087,6 +1171,18 @@ elsif ($init_mode eq "systemd") { &system_logged("systemctl disable ".quotemeta($unit). " >/dev/null 2>&1"); } +elsif ($init_mode eq "openrc") { + if (&has_command("rc-update")) { + &system_logged("rc-update del ".quotemeta($_[0]). + " >/dev/null 2>&1"); + } + else { + foreach my $a (&action_levels('S', $_[0])) { + $a =~ /^(\S+)\s+(\S+)\s+(\S+)$/ && + &delete_rl_action($_[0], $1, 'S'); + } + } + } if ($init_mode eq "init" || $init_mode eq "upstart" || $init_mode eq "systemd") { # Unlink or disable init script @@ -1251,6 +1347,11 @@ elsif ($mode eq "init") { my $fn = &action_filename($name); &unlink_logged($fn); } +elsif ($mode eq "openrc") { + &disable_at_boot($name); + my $fn = &action_filename($name); + &unlink_logged($fn); + } elsif ($mode eq "win32") { # Delete windows service &delete_win32_service($name); @@ -1303,6 +1404,16 @@ if ($action_mode eq "init" || $action_mode eq "local") { my $ex = $?; return (!$ex, $out); } +elsif ($action_mode eq "openrc") { + my $cmd = &has_command("rc-service") ? + "rc-service ".quotemeta($name)." start" : + &action_filename($name)." start"; + &clean_environment(); + my $out = &backquote_logged("$cmd 2>&1 &1 &1 &1 &1 {'name'} } &list_win32_services(); } @@ -1595,7 +1734,10 @@ like /etc/rc2.d. =cut sub runlevel_dir { -if ($_[0] eq "boot") { +if ($init_mode eq "openrc") { + return "$config{init_base}/$_[0]"; + } +elsif ($_[0] eq "boot") { return "$config{init_base}/boot.d"; } else { diff --git a/init/updateboot.pl b/init/updateboot.pl index e3ffebf5c..4e1a10dcb 100755 --- a/init/updateboot.pl +++ b/init/updateboot.pl @@ -56,6 +56,26 @@ if ($product) { quotemeta($product).".service >/dev/null 2>&1"); } } + elsif ($init_mode eq "openrc") { + my $status = &action_status($product); + my %miniserv; + &get_miniserv_config(\%miniserv); + my $want_boot = $miniserv{'atboot'} ? 1 : 0; + my $temp = &transname(); + $ENV{'WEBMIN_KILLCMD'} = &has_command('kill'); + ©_source_dest("$root_directory/webmin-gentoo-init", "$temp"); + my $lref = &read_file_lines($temp); + foreach my $l (@{$lref}) { + $l =~ s/(WEBMIN_[A-Z]+)/$ENV{$1}/g; + } + &flush_file_lines($temp); + ©_source_dest($temp, "/etc/init.d/$product"); + chmod(0755, "/etc/init.d/$product"); + &unlink_file($temp); + if ($status == 2 || $want_boot) { + &enable_at_boot($product); + } + } elsif ($init_mode eq "launchd") { # Update or create launchd agent to use start init wrapper my $name = &launchd_name($product); diff --git a/lpadmin/module.info b/lpadmin/module.info index 402248479..e826bb4fb 100644 --- a/lpadmin/module.info +++ b/lpadmin/module.info @@ -1,6 +1,6 @@ name=lpadmin category=hardware -os_support=solaris coherent-linux redhat-linux mandrake-linux slackware-linux suse-linux united-linux debian-linux freebsd hpux unixware macos open-linux turbo-linux openbsd corel-linux irix netbsd msc-linux generic-linux gentoo-linux trustix-linux openmamba-linux aix pardus-linux +os_support=solaris coherent-linux redhat-linux mandrake-linux slackware-linux suse-linux united-linux debian-linux freebsd hpux unixware macos open-linux turbo-linux openbsd corel-linux irix netbsd msc-linux generic-linux alpine-linux gentoo-linux trustix-linux openmamba-linux aix pardus-linux desc=Printer Administration longdesc=Create and edit local and remote printers. Supports Windows print servers and Ghostscript print drivers. readonly=1 diff --git a/net/alpine-linux-lib.pl b/net/alpine-linux-lib.pl new file mode 100644 index 000000000..0c1a43c52 --- /dev/null +++ b/net/alpine-linux-lib.pl @@ -0,0 +1,38 @@ +# Networking functions for Alpine Linux + +do 'debian-linux-lib.pl'; + +$network_interfaces_config = '/etc/network/interfaces'; + +# apply_network() +# Apply the interface and routing settings +sub apply_network +{ +if (&has_command("rc-service")) { + &system_logged("(cd / ; rc-service networking restart) >/dev/null 2>&1"); + } +elsif (-x "/etc/init.d/networking") { + &system_logged("(cd / ; /etc/init.d/networking restart) >/dev/null 2>&1"); + } +else { + &system_logged("(cd / ; ifdown -a ; ifup -a) >/dev/null 2>&1"); + } +} + +sub network_config_files +{ +return ( "/etc/hostname", "/etc/HOSTNAME", "/etc/mailname", + $network_interfaces_config ); +} + +sub supports_bonding +{ +return &has_command("ifenslave"); +} + +sub supports_vlans +{ +return &has_command("vconfig"); +} + +1; diff --git a/net/module.info b/net/module.info index 51e7f2c67..da0665f86 100644 --- a/net/module.info +++ b/net/module.info @@ -1,6 +1,6 @@ name=Networking category=net -os_support=solaris coherent-linux redhat-linux/5.0-* mandrake-linux united-linux suse-linux/6.0-* open-linux unixware turbo-linux/4.0 freebsd/3.2-* openbsd debian-linux/2.2-* cobalt-linux/2.2-* msc-linux gentoo-linux macos/1.5-* trustix-linux slackware-linux/8.0-* openmamba-linux cygwin windows pardus-linux +os_support=solaris coherent-linux redhat-linux/5.0-* mandrake-linux united-linux suse-linux/6.0-* open-linux unixware turbo-linux/4.0 freebsd/3.2-* openbsd debian-linux/2.2-* cobalt-linux/2.2-* msc-linux gentoo-linux alpine-linux macos/1.5-* trustix-linux slackware-linux/8.0-* openmamba-linux cygwin windows pardus-linux desc=Network Configuration longdesc=Configure boot time and active interfaces, DNS, routing and /etc/hosts. readonly=1 diff --git a/os_list.txt b/os_list.txt index 8b166c35f..7410c2158 100644 --- a/os_list.txt +++ b/os_list.txt @@ -334,6 +334,9 @@ Immunix Linux $1 redhat-linux $1 $etc_issue =~ /Immunix.*\s([0-9\.]+)/i || `ca # All versions of Gentoo (which don't appear to have version numbers) Gentoo Linux Any version gentoo-linux * -d "/usr/portage" || `cat /etc/os-release 2>/dev/null` =~ /gentoo/ +# Alpine Linux +Alpine Linux $1 alpine-linux $1 `cat /etc/alpine-release 2>/dev/null` =~ /^([0-9][0-9\.]*)/ || `cat /etc/os-release 2>/dev/null` =~ /^ID="?alpine"?$/m && `cat /etc/os-release 2>/dev/null` =~ /^VERSION_ID="?([0-9\.]+)/m + # Secure Linux (now called Trustix?) Secure Linux 1.0 redhat-linux 7.2 `cat /etc/securelinux-release 2>/dev/null` =~ /SecureLinux.*1\.0/i diff --git a/package-updates/module.info b/package-updates/module.info index 28c159516..c22d2e126 100644 --- a/package-updates/module.info +++ b/package-updates/module.info @@ -2,4 +2,4 @@ desc=Software Package Updates longdesc=Displays available package updates from YUM, APT or other update systems category=system depends=software cron mailboxes -os_support=redhat-linux debian-linux mandrake-linux/10.2-* solaris freebsd macos syno-linux +os_support=redhat-linux debian-linux mandrake-linux/10.2-* solaris freebsd macos syno-linux alpine-linux diff --git a/pap/module.info b/pap/module.info index adcf86e34..c7c8a0205 100644 --- a/pap/module.info +++ b/pap/module.info @@ -1,6 +1,6 @@ name=PPP category=net -os_support=redhat-linux mandrake-linux suse-linux united-linux slackware-linux debian-linux open-linux turbo-linux corel-linux msc-linux generic-linux gentoo-linux cobalt-linux solaris trustix-linux coherent-linux openmamba-linux pardus-linux +os_support=redhat-linux mandrake-linux suse-linux united-linux slackware-linux debian-linux open-linux turbo-linux corel-linux msc-linux generic-linux alpine-linux gentoo-linux cobalt-linux solaris trustix-linux coherent-linux openmamba-linux pardus-linux desc=PPP Dialin Server depends=inittab longdesc=Set up a dialin server using mgetty and PPP. diff --git a/sendmail/module.info b/sendmail/module.info index 7fbe0bfe1..fd98b2e73 100644 --- a/sendmail/module.info +++ b/sendmail/module.info @@ -1,6 +1,6 @@ name=Sendmail category=servers -os_support=solaris slackware-linux redhat-linux mandrake-linux suse-linux united-linux debian-linux freebsd hpux irix macos open-linux openserver unixware turbo-linux openbsd corel-linux cobalt-linux aix netbsd msc-linux osf1 generic-linux gentoo-linux{-r "/etc/sendmail.cf" || -r "/etc/mail/sendmail.cf"} sol-linux coherent-linux +os_support=solaris slackware-linux redhat-linux mandrake-linux suse-linux united-linux debian-linux freebsd hpux irix macos open-linux openserver unixware turbo-linux openbsd corel-linux cobalt-linux aix netbsd msc-linux osf1 generic-linux alpine-linux gentoo-linux{-r "/etc/sendmail.cf" || -r "/etc/mail/sendmail.cf"} sol-linux coherent-linux desc=Sendmail Mail Server longdesc=Manage sendmail aliases, masquerading, address rewriting and other features. library=sendmail-lib.pl access-lib.pl aliases-lib.pl boxes-lib.pl domain-lib.pl features-lib.pl generics-lib.pl mailers-lib.pl virtusers-lib.pl diff --git a/software/apk-lib.pl b/software/apk-lib.pl new file mode 100644 index 000000000..b8d6d595d --- /dev/null +++ b/software/apk-lib.pl @@ -0,0 +1,378 @@ +# apk-lib.pl +# Functions for Alpine Package Keeper package management + +$ENV{'PATH'} .= ":/sbin:/usr/sbin"; +$apk_installed_db = "/lib/apk/db/installed"; + +sub list_package_system_commands +{ +return ("apk"); +} + +sub list_update_system_commands +{ +return ("apk"); +} + +# parse_apk_installed() +# Returns installed packages from APK's package database +sub parse_apk_installed +{ +my @rv; +my $pkg = { }; +my $last; +open(my $db, "<", $apk_installed_db) || return (); +while(my $line = <$db>) { + $line =~ s/\r?\n$//; + if ($line eq "") { + push(@rv, $pkg) if ($pkg->{'P'}); + $pkg = { }; + $last = undef; + next; + } + if ($line =~ /^([A-Za-z]):(.*)$/) { + $pkg->{$1} = $2; + $last = $1; + } + elsif ($line =~ /^\t(.*)$/ && defined($last)) { + $pkg->{$last} .= "\n".$1; + } + } +close($db); +push(@rv, $pkg) if ($pkg->{'P'}); +return @rv; +} + +sub apk_package_class +{ +return lc($_[0]) =~ /^[a-e]/ ? "A-E" : + lc($_[0]) =~ /^[f-j]/ ? "F-J" : + lc($_[0]) =~ /^[k-o]/ ? "K-O" : + lc($_[0]) =~ /^[p-t]/ ? "P-T" : + lc($_[0]) =~ /^[u-z]/ ? "U-Z" : "Other"; +} + +sub split_apk_name_version +{ +my ($nv) = @_; +return ($1, $2) if ($nv =~ /^(.+)-([0-9][^\s]*)$/); +return ($nv, undef); +} + +sub apk_package_record +{ +my ($name, $ver) = @_; +foreach my $p (&parse_apk_installed()) { + next if ($p->{'P'} ne $name); + next if ($ver && $p->{'V'} ne $ver); + return $p; + } +return undef; +} + +sub apk_quote_packages +{ +return join(" ", map { quotemeta($_) } split(/\s+/, $_[0])); +} + +# list_packages([package]*) +# Fills the array %packages with a list of all packages +sub list_packages +{ +my %wanted = map { $_ => 1 } @_; +my $i = 0; +%packages = ( ); +foreach my $p (sort { $a->{'P'} cmp $b->{'P'} } &parse_apk_installed()) { + next if (@_ && !$wanted{$p->{'P'}}); + $packages{$i,'name'} = $p->{'P'}; + $packages{$i,'class'} = &apk_package_class($p->{'P'}); + $packages{$i,'version'} = $p->{'V'}; + $packages{$i,'desc'} = $p->{'T'}; + $packages{$i,'arch'} = $p->{'A'}; + $packages{$i,'url'} = $p->{'U'}; + $i++; + } +return $i; +} + +# package_search(string) +# Searches installed packages by name and description +sub package_search +{ +my ($search) = @_; +my $n = &list_packages(); +my $i = 0; +my %old = %packages; +%packages = ( ); +for(my $j=0; $j<$n; $j++) { + if ($old{$j,'name'} =~ /\Q$search\E/i || + $old{$j,'desc'} =~ /\Q$search\E/i) { + foreach my $k ('name', 'class', 'version', 'desc', 'arch', + 'url') { + $packages{$i,$k} = $old{$j,$k}; + } + $i++; + } + } +return $i; +} + +# package_info(package, [version]) +# Returns name, class, description, arch, version, vendor, installtime, url +sub package_info +{ +my ($name, $ver) = @_; +my $p = &apk_package_record($name, $ver); +return ( ) if (!$p); +return ( $p->{'P'}, &apk_package_class($p->{'P'}), + $p->{'T'} || $text{'apk_unknown'}, + $p->{'A'} || $text{'apk_unknown'}, + $p->{'V'} || $text{'apk_unknown'}, + $p->{'m'} || "Alpine Linux", + undef, + $p->{'U'} ); +} + +sub virtual_package_info +{ +return ( ); +} + +# package_files(package) +# Returns a list of all files in some package +sub package_files +{ +my ($name) = @_; +my $qname = quotemeta($name); +my @rv; +&open_execute_command(PKGINFO, "apk info -L $qname 2>/dev/null", 1, 1); +while() { + s/\r|\n//g; + next if (!$_ || / contains:$/); + $_ = "/".$_ if ($_ !~ /^\//); + push(@rv, $_); + } +close(PKGINFO); +return @rv; +} + +# check_files(package) +# Fills in the %files array with information about files belonging to a package +sub check_files +{ +my ($name) = @_; +my @pkgfiles = &package_files($name); +%files = ( ); +for(my $i=0; $i<@pkgfiles; $i++) { + my $path = $pkgfiles[$i]; + my $real = &translate_filename($path); + my @st = stat($real); + $files{$i,'path'} = $path; + $files{$i,'type'} = -l $real ? 3 : -d $real ? 1 : 0; + $files{$i,'user'} = @st ? getpwuid($st[4]) : undef; + $files{$i,'group'} = @st ? getgrgid($st[5]) : undef; + $files{$i,'mode'} = @st ? sprintf("%o", $st[2] & 07777) : undef; + $files{$i,'size'} = @st ? $st[7] : 0; + $files{$i,'link'} = readlink($real); + $files{$i,'error'} = "Does not exist" if (!@st); + } +return scalar(@pkgfiles); +} + +# installed_file(file) +# Fills %file with details of the package that owns a file +sub installed_file +{ +my ($path) = @_; +my $qpath = quotemeta($path); +my $out = &backquote_command("apk info -W $qpath 2>&1", 1); +return 0 if ($? || $out !~ / is owned by (\S+)/); +my ($pkg, $ver) = &split_apk_name_version($1); +my $real = &translate_filename($path); +my @st = stat($real); +%file = ( ); +$file{'path'} = $path; +$file{'type'} = -l $real ? 3 : -d $real ? 1 : 0; +$file{'user'} = @st ? getpwuid($st[4]) : undef; +$file{'group'} = @st ? getgrgid($st[5]) : undef; +$file{'mode'} = @st ? sprintf("%o", $st[2] & 07777) : undef; +$file{'size'} = @st ? $st[7] : 0; +$file{'link'} = readlink($real); +$file{'packages'} = $pkg; +$file{'versions'} = $ver; +return 1; +} + +# is_package(file) +sub is_package +{ +my ($path) = @_; +my $qpath = quotemeta($path); +my $out = &backquote_command("tar -tzf $qpath .PKGINFO 2>/dev/null", 1); +return $? ? 0 : 1; +} + +# file_packages(file) +# Returns a list of packages in an apk file, in "package description" form +sub file_packages +{ +my ($path) = @_; +my $qpath = quotemeta($path); +my $out = &backquote_command("tar -xOzf $qpath .PKGINFO 2>/dev/null", 1); +return ( ) if ($?); +my %info; +foreach my $line (split(/\r?\n/, $out)) { + if ($line =~ /^(\S+)\s*=\s*(.*)$/) { + $info{$1} = $2; + } + } +return $info{'pkgname'} ? ( $info{'pkgname'}." ".$info{'pkgdesc'} ) : ( ); +} + +sub install_options +{ +print &ui_table_row($text{'apk_untrusted'}, + &ui_yesno_radio("untrusted", 0)); +} + +# install_package(file, package, [&inputs]) +sub install_package +{ +my ($path, $package, $inref) = @_; +$inref ||= \%in; +my $qpath = quotemeta($path); +my $args = $inref->{'untrusted'} ? "--allow-untrusted " : ""; +my $out = &backquote_logged("apk add $args$qpath 2>&1 $out" : undef; +} + +# delete_package(package) +sub delete_package +{ +my ($name) = @_; +my $out = &backquote_logged("apk del ".quotemeta($name)." 2>&1 $out" : undef; +} + +sub package_dependencies +{ +my ($name, $ver) = @_; +my $p = &apk_package_record($name, $ver); +return ( ) if (!$p || !$p->{'D'}); +my @rv; +foreach my $dep (split(/\s+/, $p->{'D'})) { + next if (!$dep); + $dep =~ s/^\!//; + if ($dep =~ /^([A-Za-z0-9+_.-]+)([<>=~]+)(\S+)$/) { + push(@rv, { 'package' => $1, + 'compare' => $2, + 'version' => $3 }); + } + elsif ($dep =~ /^[A-Za-z0-9+_.-]+$/) { + push(@rv, { 'package' => $dep }); + } + else { + push(@rv, { 'other' => $dep }); + } + } +return @rv; +} + +sub package_system +{ +return $text{'apk_manager'}; +} + +sub package_help +{ +return "apk"; +} + +###### Update system functions + +sub update_system_search +{ +my ($search) = @_; +my $pattern = defined($search) && $search ne "" && $search ne ".*" ? + "*".$search."*" : "*"; +my @rv; +&clean_language(); +&open_execute_command(SEARCH, "apk search -v ".quotemeta($pattern)." 2>/dev/null", 1, 1); +while() { + s/\r|\n//g; + if (/^(.+)-([0-9][^\s]*)\s+-\s+(.*)$/) { + push(@rv, { 'name' => $1, + 'version' => $2, + 'desc' => $3 }); + } + } +close(SEARCH); +&reset_environment(); +return @rv; +} + +sub update_system_available +{ +&execute_command("apk update"); +return &update_system_search(".*"); +} + +sub update_system_updates +{ +my @rv; +&execute_command("apk update"); +&clean_language(); +&open_execute_command(UPDATES, "apk version -l '<' -v 2>/dev/null", 1, 1); +while() { + s/\r|\n//g; + if (/^(.+)-([0-9][^\s]*)\s+<\s+(\S+)/) { + push(@rv, { 'name' => $1, + 'oldversion' => $2, + 'version' => $3 }); + } + } +close(UPDATES); +&reset_environment(); +return @rv; +} + +sub update_system_install +{ +my $update = $_[0] || $in{'update'}; +my @rv; +my $qupdate = &apk_quote_packages($update); +my $cmd = "apk add --update --upgrade $qupdate"; +print &text('apk_install', "".&html_escape($cmd).""),"\n"; +print "
";
+&additional_log('exec', undef, $cmd);
+&open_execute_command(CMD, "$cmd 2>&1 ) {
+	if (/\b(?:Installing|Upgrading|Downgrading)\s+(\S+)\s+\(/) {
+		push(@rv, $1);
+		}
+	print &html_escape($_);
+	}
+close(CMD);
+print "
\n"; +if ($?) { print "$text{'apk_failed'}

\n"; } +else { print "$text{'apk_ok'}

\n"; } +return &unique(@rv); +} + +sub update_system_resolve +{ +my ($name) = @_; +return $name eq "apache" ? "apache2" : + $name eq "dhcpd" ? "dhcp" : + $name eq "mysql" ? "mariadb mariadb-client" : + $name eq "postgresql" ? "postgresql postgresql-client" : + $name eq "openldap" ? "openldap openldap-clients" : + $name eq "ldap" ? "openldap openldap-clients" : + $name eq "dovecot" ? "dovecot" : + $name eq "samba" ? "samba samba-client" : + $name eq "openssh" ? "openssh" : + $name eq "squid" ? "squid" : + $name; +} + +1; diff --git a/software/config-alpine-linux b/software/config-alpine-linux new file mode 100644 index 000000000..4192f1adf --- /dev/null +++ b/software/config-alpine-linux @@ -0,0 +1,2 @@ +package_system=apk +update_system=apk diff --git a/software/config.info b/software/config.info index af1f2c93a..55113d2d6 100644 --- a/software/config.info +++ b/software/config.info @@ -1,3 +1,3 @@ -package_system=Package management system,1,rpm-RPM,pkgadd-Solaris,hpux-HPUX,freebsd-FreeBSD,slackware-Slackware,debian-Debian,aix-AIX,emerge-Gentoo,cygwin-Cygwin,msi-Microsoft Installer,pkgsrc-PKGsrc,ipkg-Synology IPKG -update_system=Package update system,1,-Detect automatically,apt-APT,yum-YUM,rhn-Redhat Network,csw-Blastwave CSW,urpmi-URPMI,emerge-Emerge,ports-FreeBSD Ports,pkg-FreeBSD pkgng,pkgsrc-PKGsrc,ipkg-Synology IPKG update,*-None +package_system=Package management system,1,rpm-RPM,pkgadd-Solaris,hpux-HPUX,freebsd-FreeBSD,slackware-Slackware,debian-Debian,aix-AIX,emerge-Gentoo,apk-Alpine APK,cygwin-Cygwin,msi-Microsoft Installer,pkgsrc-PKGsrc,ipkg-Synology IPKG +update_system=Package update system,1,-Detect automatically,apt-APT,yum-YUM,rhn-Redhat Network,csw-Blastwave CSW,urpmi-URPMI,emerge-Emerge,apk-Alpine APK,ports-FreeBSD Ports,pkg-FreeBSD pkgng,pkgsrc-PKGsrc,ipkg-Synology IPKG update,*-None apt_mode=Command to use for APT installs,1,0-apt-get,1-aptitude diff --git a/software/lang/en b/software/lang/en index ac1bb3398..8a890e515 100644 --- a/software/lang/en +++ b/software/lang/en @@ -180,6 +180,10 @@ debian_overwrite=Overwrite files from other packages? debian_downgrade=Replace newer package with old? debian_manager=Debian +apk_unknown=Unknown +apk_manager=Alpine Package Keeper +apk_untrusted=Allow untrusted package file? + log_install_package=Installed package $1 log_install_apt_l=Installed package(s) $1 from APT log_install_apt=Installed $2 package(s) from APT @@ -361,6 +365,13 @@ emerge_onlydeps=Only install dependencies? emerge_title=Search Portage emerge_name=Portage +apk_input=Package from APK +apk_find=Search APK .. +apk_install=Installing package(s) with command $1 .. +apk_ok=.. install complete +apk_failed=.. install failed! +apk_name=APK + cygwin_fmissing=The file is missing cygwin_lmissing=The file to which the link points is missing cygwin_estat=Failed to stat file: $1 diff --git a/software/module.info b/software/module.info index dd4b6bd63..ef60771e1 100644 --- a/software/module.info +++ b/software/module.info @@ -1,6 +1,6 @@ name=PackageAdmin category=system -os_support=solaris coherent-linux redhat-linux mandrake-linux suse-linux united-linux hpux open-linux openserver unixware freebsd/3.0-* slackware-linux/4.0-* debian-linux/2.0-* turbo-linux openbsd corel-linux cobalt-linux netbsd msc-linux aix gentoo-linux trustix-linux openmamba-linux cygwin windows syno-linux +os_support=solaris coherent-linux redhat-linux mandrake-linux suse-linux united-linux hpux open-linux openserver unixware freebsd/3.0-* slackware-linux/4.0-* debian-linux/2.0-* turbo-linux openbsd corel-linux cobalt-linux netbsd msc-linux aix gentoo-linux alpine-linux trustix-linux openmamba-linux cygwin windows syno-linux desc=Software Packages longdesc=Manage software packages on your system, and install new packages. readonly=1 diff --git a/squid/module.info b/squid/module.info index c7703bc9f..3571b3b70 100644 --- a/squid/module.info +++ b/squid/module.info @@ -1,6 +1,6 @@ name=Squid category=servers -os_support=solaris hpux redhat-linux mandrake-linux debian-linux suse-linux united-linux slackware-linux freebsd osf1 irix aix open-linux openserver unixware turbo-linux openbsd corel-linux cobalt-linux lfs-linux macos netbsd msc-linux generic-linux gentoo-linux trustix-linux sol-linux coherent-linux openmamba-linux pardus-linux +os_support=solaris hpux redhat-linux mandrake-linux debian-linux suse-linux united-linux slackware-linux freebsd osf1 irix aix open-linux openserver unixware turbo-linux openbsd corel-linux cobalt-linux lfs-linux macos netbsd msc-linux generic-linux alpine-linux gentoo-linux trustix-linux sol-linux coherent-linux openmamba-linux pardus-linux desc=Squid Proxy Server longdesc=Configure Squid options, ACLs, caching parameters and proxy users. syslog=1 diff --git a/useradmin/module.info b/useradmin/module.info index e0cf62e9c..19663daba 100644 --- a/useradmin/module.info +++ b/useradmin/module.info @@ -1,6 +1,6 @@ name=User Manager category=system -os_support=slackware-linux redhat-linux mandrake-linux solaris debian-linux suse-linux united-linux hpux freebsd osf1 open-linux unixware turbo-linux openbsd corel-linux cobalt-linux irix aix netbsd msc-linux openserver generic-linux macos gentoo-linux trustix-linux sol-linux coherent-linux openmamba-linux pardus-linux syno-linux +os_support=slackware-linux redhat-linux mandrake-linux solaris debian-linux suse-linux united-linux hpux freebsd osf1 open-linux unixware turbo-linux openbsd corel-linux cobalt-linux irix aix netbsd msc-linux openserver generic-linux alpine-linux macos gentoo-linux trustix-linux sol-linux coherent-linux openmamba-linux pardus-linux syno-linux desc=Users and Groups longdesc=Create and edit Unix users and groups from the /etc/passwd and /etc/group files. readonly=1 diff --git a/webmin-gentoo-init b/webmin-gentoo-init index 705360acb..24dd79adb 100755 --- a/webmin-gentoo-init +++ b/webmin-gentoo-init @@ -5,11 +5,7 @@ name="webmin" -# config file must be in sync with setup script, so i will not touch cos process will be the same as webmin-systemd -# like calling updateboot.pl with a new procedure method defined as openrc and not just assumed sysvinit if not systemd is present -# and also atboot.pl with new procedure for openrc the alpine linux init system at the moment -#conf_file="WEBMIN_CONFIG/miniserv.conf" -conf_file="/etc/webmin/miniserv.conf" +conf_file="WEBMIN_CONFIG/miniserv.conf" depend() { @@ -19,16 +15,12 @@ depend() { } start() { -# same problem here.. we need to use WEBMIN_CONFIG variable to find the start script -# WEBMIN_CONFIG/start - /etc/webmin/start + WEBMIN_CONFIG/start eend $? } stop() { -# same problem here.. we need to use WEBMIN_CONFIG variable to find the stop script -# WEBMIN_CONFIG/stop - /etc/webmin/stop + WEBMIN_CONFIG/stop eend $? }