5 # Email : hayao@fascone.net
7 # (c) 2019-2020 Fascode Network.
11 # Script to import AlterLinux and ArchLinux keys.
17 script_path="$(readlink -f ${0%/*})"
20 # Set pacman.conf when build alterlinux
21 alter_pacman_conf="${script_path}/system/pacman.conf"
26 echo -e "[keyring.sh] ERROR : ${@}" >&2
32 echo -e "[keyring.sh] INFO: ${@}" >&1
38 echo "usage ${0} [options]"
40 echo " General options:"
41 echo " -a | --alter-add Add alterlinux-keyring."
42 echo " -r | --alter-remove Remove alterlinux-keyring."
43 echo " -c | --arch-add Add archlinux-keyring."
44 echo " -h | --help Show this help and exit."
49 # Check if the package is installed.
52 _pkg=$(echo "${1}" | cut -d'/' -f2)
54 if [[ ${#} -gt 2 ]]; then
55 msg_error "Multiple package specification is not available."
58 if [[ -n $( pacman -Q "${_pkg}" 2> /dev/null| awk '{print $1}' ) ]]; then
68 if [[ $(checkpkg "${i}") = false ]]; then
69 pacman -S --noconfirm "${i}"
76 msg_info "Running ${@}"
82 if [[ ! ${UID} = 0 ]]; then
83 msg_error "You dont have root permission."
84 msg_error 'Please run as root.'
88 if [[ ! -f "${alter_pacman_conf}" ]]; then
89 msg_error "${alter_pacman_conf} does not exist."
98 pacman-key --populate archlinux
99 _pacman_install core/archlinux-keyring
100 pacman-key --refresh-keys
106 curl -L -o "/tmp/fascode.pub" "https://山d.com/repo/fascode.pub"
107 pacman-key -a "/tmp/fascode.pub"
108 rm -f "/tmp/fascode.pub"
109 pacman-key --lsign-key development@fascode.net
111 pacman --config "${alter_pacman_conf}" -Sy --noconfirm
112 pacman --config "${alter_pacman_conf}" -S --noconfirm alter-stable/alterlinux-keyring
115 pacman-key --populate alterlinux
121 pacman-key -d BDC396346243AB57ACD090F9F50544048389DA36
122 if checkpkg alterlinux-keyring; then
123 pacman -Rsnc --noconfirm alterlinux-keyring
130 while getopts 'arch-:' arg; do
179 if [[ ${#} = 0 ]]; then
181 # run update_arch_key