mirror of
https://gitee.com/amber-ce/amber-pm
synced 2026-03-26 07:29:52 +08:00
src update
This commit is contained in:
1
src/usr/bin/amber-pm-configure-nvidia
Symbolic link
1
src/usr/bin/amber-pm-configure-nvidia
Symbolic link
@@ -0,0 +1 @@
|
||||
../../var/lib/apm/apm/files/bin/amber-ce-configure-nvidia
|
||||
21
src/usr/bin/amber-pm-configure-nvidia-host
Executable file
21
src/usr/bin/amber-pm-configure-nvidia-host
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
APM_BASE="/var/lib/apm"
|
||||
|
||||
# 遍历 /var/lib/apm 下的所有目录
|
||||
for dir in "$APM_BASE"/*/; do
|
||||
# 移除末尾的斜杠获取目录名
|
||||
dirname=$(basename "$dir")
|
||||
|
||||
# 跳过名为 "apm" 的目录
|
||||
if [[ "$dirname" == "apm" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# 检查是否存在 /var/lib/apm/目录名/files/ace-env
|
||||
if [[ -f "$dir/files/ace-env" ]]; then
|
||||
echo "执行 apm-configure-nvidia: $dir"
|
||||
amber-pm-configure-nvidia "$dir/files/ace-env"
|
||||
fi
|
||||
|
||||
done
|
||||
1
src/usr/bin/amber-pm-debug
Symbolic link
1
src/usr/bin/amber-pm-debug
Symbolic link
@@ -0,0 +1 @@
|
||||
../../var/lib/apm/apm/files/bin/ace-run
|
||||
128
src/usr/bin/amber-pm-dstore-patch
Executable file
128
src/usr/bin/amber-pm-dstore-patch
Executable file
@@ -0,0 +1,128 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
enumAppInfoList() {
|
||||
appInfoList=()
|
||||
apps="/var/lib/apm"
|
||||
list=$(ls $apps 2>/dev/null)
|
||||
for appID in $list; do
|
||||
appInfoList+=("$appID")
|
||||
done
|
||||
echo "${appInfoList[@]}"
|
||||
}
|
||||
linkDir() {
|
||||
ensureTargetDir() {
|
||||
targetFile=$1
|
||||
t=$(dirname "$targetFile")
|
||||
mkdir -p "$t"
|
||||
}
|
||||
|
||||
source=$1
|
||||
target=$2
|
||||
sourceDir=$(dirname "$source")
|
||||
targetDir=$(dirname "$target")
|
||||
find "$source" -type f | while read sourceFile; do
|
||||
targetFile="$targetDir/${sourceFile#$sourceDir/}"
|
||||
|
||||
|
||||
ensureTargetDir "$targetFile"
|
||||
sourceFile=$(realpath --relative-to="$(dirname $targetFile)" "$sourceFile" )
|
||||
if [ ! -e ${targetFile} ];then
|
||||
ln -sv "$sourceFile" "$targetFile"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
linkApp() {
|
||||
appID=$1
|
||||
appEntriesDir="/var/lib/apm/$appID/entries"
|
||||
appLibsDir="/var/lib/apm/$appID/files/lib"
|
||||
autoStartDir="$appEntriesDir/autostart"
|
||||
|
||||
if [ -d "$autoStartDir" ]; then
|
||||
linkDir "$autoStartDir" "/etc/xdg/autostart"
|
||||
fi
|
||||
|
||||
# link application
|
||||
sysShareDir="/usr/share"
|
||||
for folder in "$appEntriesDir/applications" "$appEntriesDir/icons" "$appEntriesDir/mime" "$appEntriesDir/glib-2.0" "$appEntriesDir/services" "$appEntriesDir/GConf" "$appEntriesDir/help" "$appEntriesDir/locale" "$appEntriesDir/fcitx"; do
|
||||
if [ ! -d "$folder" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ "$folder" = "$appEntriesDir/polkit" ]; then
|
||||
linkDir "$folder" "/usr/share/polkit-1"
|
||||
elif [ "$folder" = "$appEntriesDir/fonts/conf" ]; then
|
||||
linkDir "$folder" "/etc/fonts/conf.d"
|
||||
else
|
||||
linkDir "$folder" "$sysShareDir/${folder##*/}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function exec_uos_package_link(){
|
||||
|
||||
for app in $(enumAppInfoList); do
|
||||
linkApp "$app" &
|
||||
|
||||
done
|
||||
wait
|
||||
}
|
||||
|
||||
function exec_v23_icon_link(){
|
||||
# Fix v23 broken icon
|
||||
if [ ! -d "/usr/share/icons/hicolor/scalable/apps" ];then
|
||||
mkdir -p /usr/share/icons/hicolor/scalable/apps
|
||||
fi
|
||||
|
||||
for icon_root_icon_path in $(ls /usr/share/icons/*.png /usr/share/icons/*.svg 2>/dev/null)
|
||||
do
|
||||
target_icon_path=/usr/share/icons/hicolor/scalable/apps/$(basename ${icon_root_icon_path})
|
||||
if [ ! -e ${target_icon_path} ];then
|
||||
ln -sv $(realpath --relative-to=/usr/share/icons/hicolor/scalable/apps ${icon_root_icon_path}) /usr/share/icons/hicolor/scalable/apps
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function exec_link_clean(){
|
||||
# remove broken links in /usr/share
|
||||
|
||||
find /usr/share/applications -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||
find /usr/share/icons -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||
find /usr/share/mime/packages -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||
find /usr/share/glib-2.0 -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||
find /usr/share/dbus-1/services -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||
find /usr/share/fcitx -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||
find /usr/share/help -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||
find /usr/share/locale -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||
find /usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`/fcitx -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||
find /usr/lib/mozilla/plugins -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||
find /usr/share/polkit-1/actions -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||
find /usr/share/fonts -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||
find /etc/fonts/conf.d -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null &
|
||||
|
||||
|
||||
}
|
||||
function exec_uos_package_update(){
|
||||
update-icon-caches /usr/share/icons/* > /dev/null 2>&1 &
|
||||
update-desktop-database -q > /dev/null 2>&1 &
|
||||
update-mime-database -V /usr/share/mime > /dev/null 2>&1 &
|
||||
glib-compile-schemas /usr/share/glib-2.0/schemas/ > /dev/null 2>&1 &
|
||||
|
||||
}
|
||||
|
||||
#########################################################################################
|
||||
echo "----------------Running APM Dstore Patch----------------"
|
||||
if [ ! -e /usr/bin/deepin-app-store-tool ];then
|
||||
# execute linkApp function for each app and print output
|
||||
exec_uos_package_link
|
||||
|
||||
fi
|
||||
#exec_v23_icon_link
|
||||
exec_link_clean
|
||||
wait
|
||||
exec_uos_package_update
|
||||
echo "----------------Finished----------------"
|
||||
173
src/usr/bin/apm
Executable file
173
src/usr/bin/apm
Executable file
@@ -0,0 +1,173 @@
|
||||
#!/bin/bash
|
||||
VERSION=1.0.5
|
||||
# 获取脚本名称用于帮助信息
|
||||
SCRIPT_NAME=$(basename "$0")
|
||||
PATH_PREFIX=/var/lib/apm/apm/files/ace-env/
|
||||
|
||||
log.warn() { echo -e "[\e[33mWARN\e[0m]: \e[1m$*\e[0m"; }
|
||||
log.error() { echo -e "[\e[31mERROR\e[0m]: \e[1m$*\e[0m"; }
|
||||
log.info() { echo -e "[\e[96mINFO\e[0m]: \e[1m$*\e[0m"; }
|
||||
log.debug() { echo -e "[\e[32mDEBUG\e[0m]: \e[1m$*\e[0m"; }
|
||||
|
||||
# 帮助信息函数
|
||||
show_help() {
|
||||
cat <<EOF
|
||||
APM - Amber Package Manager ${VERSION}
|
||||
|
||||
Usage:
|
||||
$SCRIPT_NAME [COMMAND] [OPTIONS] [PACKAGES...]
|
||||
|
||||
Commands:
|
||||
install 安装软件包
|
||||
remove 卸载软件包
|
||||
update 更新软件包信息
|
||||
autoremove 自动移除不需要的包
|
||||
full-upgrade 完全升级软件包
|
||||
run <package> 运行指定软件包的可执行文件
|
||||
ssaudit <path> 使用 ssaudit 进行软件安装,详情见 spark-store
|
||||
debug 显示调试系统信息
|
||||
-h, --help 显示此帮助信息
|
||||
--amber 彩蛋功能
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
apm_exec(){
|
||||
mkdir -p /tmp/apm/${coredir}
|
||||
fuse-overlayfs -o lowerdir="${PATH_PREFIX}/var/lib/apm/${basedir}/files/ace-env",upperdir="${PATH_PREFIX}/var/lib/apm/${coredir}/files/core/",workdir="${PATH_PREFIX}/var/lib/apm/${coredir}/files/work/" "/tmp/apm/${coredir}"
|
||||
|
||||
chrootEnvPath=/tmp/apm/${coredir} /var/lib/apm/apm/files/ace-run "$@"
|
||||
umount /tmp/apm/${coredir}
|
||||
|
||||
}
|
||||
|
||||
# 调试信息函数
|
||||
debug_info() {
|
||||
log.debug "======= APM Debug Information ======="
|
||||
log.debug "User: $(whoami)"
|
||||
log.debug "Hostname: $(hostname)"
|
||||
log.debug "OS: $(lsb_release -ds 2>/dev/null || uname -om)"
|
||||
log.debug "Kernel: $(uname -sr)"
|
||||
log.debug "Bash Version: ${BASH_VERSION}"
|
||||
log.debug "APT Version: $(apt --version | head -n1)"
|
||||
log.debug "APM APT Version: $(amber-pm-debug apt --version | head -n1)"
|
||||
log.debug "====================================="
|
||||
|
||||
amber-pm-debug "$@"
|
||||
|
||||
}
|
||||
|
||||
# 彩蛋函数
|
||||
amber_egg() {
|
||||
cat <<'EOF'
|
||||
|
||||
____ ____
|
||||
/ __ )____ __________ ____ / __ )__ ______ ____ __ __
|
||||
/ __ / __ `/ ___/ __ \/ __ \ / __ / / / / __ \/ __ \/ / / /
|
||||
/ /_/ / /_/ / / / /_/ / / / / / /_/ / /_/ / / / / / / / /_/ /
|
||||
/_____/\__,_/_/ \____/_/ /_/ /_____/\__,_/_/ /_/_/ /_/\__, /
|
||||
/____/
|
||||
|
||||
Amber Package Manager - Sparkling with magic!
|
||||
💎 Another target tracked down by Outrider Amber!
|
||||
EOF
|
||||
}
|
||||
|
||||
apm-nvidia-toggle(){
|
||||
|
||||
# APM 基础路径
|
||||
APM_BASE="${PATH_PREFIX}/var/lib/apm"
|
||||
|
||||
# 检查基础目录是否存在
|
||||
if [[ ! -d "$APM_BASE" ]]; then
|
||||
echo "错误: 目录 $APM_BASE 不存在"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 遍历 /var/lib/apm 下的所有目录
|
||||
for dir in "$APM_BASE"/*/; do
|
||||
# 移除末尾的斜杠得到纯目录名
|
||||
dir="${dir%/}"
|
||||
|
||||
# 提取目录名(不包括完整路径)
|
||||
dirname=$(basename "$dir")
|
||||
# 检查目标文件是否存在
|
||||
target_file="${APM_BASE}/${dirname}/files/ace-env"
|
||||
if [[ -e "$target_file" ]]; then
|
||||
|
||||
# 将目录传递给 amber-pm-configure-nvidia
|
||||
amber-pm-configure-nvidia "$target_file"
|
||||
|
||||
|
||||
fi
|
||||
done
|
||||
}
|
||||
# 主命令处理
|
||||
case "$1" in
|
||||
install|full-upgrade|upgrade|reinstall)
|
||||
command=$1
|
||||
shift
|
||||
amber-pm-debug aptss "$command" "$@"
|
||||
apm-nvidia-toggle
|
||||
;;
|
||||
remove|autoremove|search|policy|list|update)
|
||||
# 特殊APT命令:移除第一个参数后传递其余参数
|
||||
command=$1
|
||||
shift
|
||||
amber-pm-debug aptss "$command" "$@"
|
||||
;;
|
||||
run)
|
||||
# 运行包命令:第二个参数必须是包名
|
||||
if [ -z "$2" ]; then
|
||||
log.error "Package name required for 'run' command"
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查包是否已安装
|
||||
pkg="$2"
|
||||
shift 2 # 移除 'run' 和包名
|
||||
|
||||
if ! ls "${PATH_PREFIX}/var/lib/apm/$pkg" >/dev/null 2>&1; then
|
||||
# 如果带前缀的目录不存在,尝试不带前缀的目录
|
||||
if ls "/var/lib/apm/$pkg" >/dev/null 2>&1; then
|
||||
# 如果不带前缀的目录存在,清空 PATH_PREFIX
|
||||
PATH_PREFIX=""
|
||||
else
|
||||
# 如果两个目录都不存在,报错退出
|
||||
log.error "Package not installed: $pkg"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
coredir=$pkg
|
||||
basedir=$(cat ${PATH_PREFIX}/var/lib/apm/${coredir}/info)
|
||||
|
||||
|
||||
# 检测是否有额外命令参数
|
||||
if [ $# -gt 0 ]; then
|
||||
# 有额外参数:执行用户提供的命令
|
||||
log.info "Running user command: $*"
|
||||
apm_exec "$@"
|
||||
else
|
||||
# 没有额外参数:提示
|
||||
log.info "Usage: $SCRIPT_NAME run $pkg [EXEC_PATH]"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
debug)
|
||||
debug_info
|
||||
;;
|
||||
ssaudit)
|
||||
ssaudit "$@" --native
|
||||
;;
|
||||
-h|--help)
|
||||
show_help
|
||||
;;
|
||||
--amber)
|
||||
amber_egg
|
||||
;;
|
||||
*)
|
||||
show_help
|
||||
;;
|
||||
esac
|
||||
6
src/usr/lib/sysctl.d/apm.conf
Executable file
6
src/usr/lib/sysctl.d/apm.conf
Executable file
@@ -0,0 +1,6 @@
|
||||
# ACE app runs in a container, need privileges within user namespace, so we need to set it
|
||||
kernel.unprivileged_userns_clone=1
|
||||
# Ubuntu 24.04 has more limitation on unprivileged user namespace,so we have to disable them.
|
||||
# refer to https://ubuntu.com/blog/ubuntu-23-10-restricted-unprivileged-user-namespaces
|
||||
kernel.apparmor_restrict_unprivileged_unconfined=0
|
||||
kernel.apparmor_restrict_unprivileged_userns=0
|
||||
14
src/usr/lib/systemd/system/apm-daily-update.service
Executable file
14
src/usr/lib/systemd/system/apm-daily-update.service
Executable file
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=APM GXDE Fixer
|
||||
After=apt-daily.service network.target network-online.target systemd-networkd.service NetworkManager.service connman.service
|
||||
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/var/lib/apm/apm/files/bin/ace-gxde-fixer
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
14
src/usr/lib/systemd/system/gxde-apm-fixer.service
Executable file
14
src/usr/lib/systemd/system/gxde-apm-fixer.service
Executable file
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=APM GXDE Fixer
|
||||
After=apt-daily.service network.target network-online.target systemd-networkd.service NetworkManager.service connman.service
|
||||
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
RemainAfterExit=yes
|
||||
ExecStart=apm update
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
17
src/usr/lib/systemd/user-environment-generators/60-apm
Executable file
17
src/usr/lib/systemd/user-environment-generators/60-apm
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
|
||||
# Ensure base distro defaults xdg path are set if nothing filed up some
|
||||
# defaults yet.
|
||||
if [ -z "$XDG_DATA_DIRS" ]; then
|
||||
export XDG_DATA_DIRS="/usr/local/share:/usr/share"
|
||||
fi
|
||||
|
||||
# Desktop files (used by desktop environments within both X11 and Wayland) are
|
||||
# looked for in XDG_DATA_DIRS; make sure it includes the relevant directory for ACE
|
||||
ACE_path="/var/lib/apm/apm/files/ace-env/usr/share/"
|
||||
if [ -n "${XDG_DATA_DIRS##*${ACE_path}}" ] && [ -n "${XDG_DATA_DIRS##*${ACE_path}:*}" ]; then
|
||||
export XDG_DATA_DIRS="${XDG_DATA_DIRS}:${ACE_path}"
|
||||
fi
|
||||
|
||||
214
src/usr/share/bash-completion/completions/apm
Executable file
214
src/usr/share/bash-completion/completions/apm
Executable file
@@ -0,0 +1,214 @@
|
||||
# Debian apt(8) completion -*- shell-script -*-
|
||||
|
||||
_apm()
|
||||
{
|
||||
local sourcesdir="/etc/apt/sources.list.d"
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
local GENERIC_APT_GET_OPTIONS='
|
||||
-d --download-only
|
||||
-y --assume-yes
|
||||
--assume-no
|
||||
-u --show-upgraded
|
||||
-m --ignore-missing
|
||||
-t --target-release
|
||||
--download
|
||||
--fix-missing
|
||||
--ignore-hold
|
||||
--upgrade
|
||||
--only-upgrade
|
||||
--allow-change-held-packages
|
||||
--allow-remove-essential
|
||||
--allow-downgrades
|
||||
--print-uris
|
||||
--trivial-only
|
||||
--remove
|
||||
--arch-only
|
||||
--allow-unauthenticated
|
||||
--allow-insecure-repositories
|
||||
--install-recommends
|
||||
--install-suggests
|
||||
--no-install-recommends
|
||||
--no-install-suggests
|
||||
--fix-policy
|
||||
'
|
||||
|
||||
# see if the user selected a command already
|
||||
local COMMANDS=(
|
||||
"ssupdate"
|
||||
"list"
|
||||
"search"
|
||||
"show" "showsrc"
|
||||
"install" "remove" "purge" "autoremove" "autopurge"
|
||||
"update"
|
||||
"upgrade" "full-upgrade" "dist-upgrade"
|
||||
"edit-sources"
|
||||
"help"
|
||||
"source" "build-dep"
|
||||
"clean" "autoclean"
|
||||
"download" "changelog"
|
||||
"moo"
|
||||
"depends" "rdepends"
|
||||
"policy")
|
||||
|
||||
local command i
|
||||
for (( i=0; i < ${#words[@]}-1; i++ )); do
|
||||
if [[ ${COMMANDS[@]} =~ ${words[i]} ]]; then
|
||||
command=${words[i]}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
|
||||
# supported options per command
|
||||
if [[ "$cur" == -* ]]; then
|
||||
case $command in
|
||||
install|remove|purge|upgrade|dist-upgrade|full-upgrade|autoremove)
|
||||
COMPREPLY=( $( compgen -W '--show-progress
|
||||
--fix-broken --purge --verbose-versions --auto-remove
|
||||
-s --simulate --dry-run
|
||||
--download
|
||||
--fix-missing
|
||||
--fix-policy
|
||||
--ignore-hold
|
||||
--force-yes
|
||||
--trivial-only
|
||||
--reinstall --solver
|
||||
-t --target-release'"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
update)
|
||||
COMPREPLY=( $( compgen -W '--list-cleanup
|
||||
--print-uris
|
||||
--allow-insecure-repositories
|
||||
' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
list)
|
||||
COMPREPLY=( $( compgen -W '--installed --upgradable
|
||||
--manual-installed
|
||||
-v --verbose
|
||||
-a --all-versions
|
||||
-t --target-release
|
||||
' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
show)
|
||||
COMPREPLY=( $( compgen -W '-a --all-versions
|
||||
' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
depends|rdepends)
|
||||
COMPREPLY=( $( compgen -W '-i
|
||||
--important
|
||||
--installed
|
||||
--pre-depends
|
||||
--depends
|
||||
--recommends
|
||||
--suggests
|
||||
--replaces
|
||||
--breaks
|
||||
--conflicts
|
||||
--enhances
|
||||
--recurse
|
||||
--implicit' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
search)
|
||||
COMPREPLY=( $( compgen -W '
|
||||
-n --names-only
|
||||
-f --full' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
showsrc)
|
||||
COMPREPLY=( $( compgen -W '
|
||||
--only-source' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
source)
|
||||
COMPREPLY=( $( compgen -W '
|
||||
-s --simulate --dry-run
|
||||
-b --compile --build
|
||||
-P --build-profiles
|
||||
--diff-only --debian-only
|
||||
--tar-only
|
||||
--dsc-only
|
||||
-t --target-release
|
||||
'"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
build-dep)
|
||||
COMPREPLY=( $( compgen -W '
|
||||
-a --host-architecture
|
||||
-s --simulate --dry-run
|
||||
-P --build-profiles
|
||||
-t --target-release
|
||||
--purge --solver
|
||||
'"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
moo)
|
||||
COMPREPLY=( $( compgen -W '
|
||||
--color
|
||||
' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
clean|autoclean)
|
||||
COMPREPLY=( $( compgen -W '
|
||||
-s --simulate --dry-run
|
||||
' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# specific command arguments
|
||||
if [[ -n $command ]]; then
|
||||
case $command in
|
||||
remove|purge|autoremove)
|
||||
# Debian system
|
||||
|
||||
|
||||
COMPREPLY=( $( compgen -W "$(ls /var/lib/apm/apm/files/ace-env/var/lib/apm/ )" $cur ) )
|
||||
|
||||
return 0
|
||||
;;
|
||||
show|list|download|changelog|depends|rdepends)
|
||||
COMPREPLY=( $( amber-pm-debug apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/var/lib/aptss/" \
|
||||
2> /dev/null ) )
|
||||
return 0
|
||||
;;
|
||||
install)
|
||||
COMPREPLY=( $( amber-pm-debug apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/var/lib/aptss/" \
|
||||
2> /dev/null ) )
|
||||
if [[ "$cur" == ./* || "$cur" == /* ]]; then
|
||||
_filedir "deb"
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
source|build-dep|showsrc|policy)
|
||||
COMPREPLY=( $( amber-pm-debug apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/var/lib/aptss/" \
|
||||
2> /dev/null ) $( apt-cache dumpavail -o Dir::Cache="/var/lib/aptss/" | \
|
||||
command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) )
|
||||
return 0
|
||||
;;
|
||||
moo)
|
||||
COMPREPLY=( $( compgen -W 'moo' \
|
||||
-- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# no command yet, show what commands we have
|
||||
if [ "$command" = "" ]; then
|
||||
COMPREPLY=( $( compgen -W '${COMMANDS[@]}' -- "$cur" ) )
|
||||
fi
|
||||
|
||||
return 0
|
||||
} &&
|
||||
complete -F _apm apm
|
||||
|
||||
# ex: ts=4 sw=4 et filetype=sh
|
||||
Reference in New Issue
Block a user