Commit d3fdb070 authored by Lukas Appelhans's avatar Lukas Appelhans

Merge branch 'master' of gitorious.org:chakra/akabei

parents 556d493b 8b7a6084
[main]
host = https://www.transifex.net
host = https://www.transifex.com
[chakra-project.akabei]
[chakra.akabei]
file_filter = translations/<lang>.po
source_file = translations/akabei.pot
source_lang = en
......
......@@ -377,13 +377,13 @@ int main(int argc, char **argv)
QByteArray("0.0.1"),
QObject::tr("Chakra's CLI package manager"),
AkabeiLicense::License_GPL_V2,
QObject::tr("(C) 2011 - 2012 The Akabei Developers"),
QObject::tr("(C) 2011 - 2015 The Akabei Developers"),
QObject::tr("<a href=\"mailto:boom1992@chakra-project.org\">boom1992@chakra-project.org</a>"),
"http://chakra-project.org",
"http://chakra-project.org/bugs/"
"http://chakraos.org",
"http://chakraos.org/bugtracker/"
);
aboutData.addAuthor(QObject::tr("Lukas Appelhans"), QObject::tr("Maintainer"), "boom1992@chakra-project.org");
aboutData.addAuthor(QObject::tr("Lisa Vitolo"), QObject::tr("Maintainer"), "shainer@chakra-project.org");
aboutData.addAuthor("Lukas Appelhans", QObject::tr("Maintainer"), "boom1992@chakra-project.org");
aboutData.addAuthor("Lisa Vitolo", QObject::tr("Maintainer"), "shainer@chakra-project.org");
CommandLineParser *parser = NULL;
QTextStream err(stderr);
......
......@@ -59,18 +59,18 @@ void CommandLineUtils::printHelpMessage(QMultiHash<APM::OperationType, AkabeiOpe
QTextStream out(stdout);
QHash<APM::OperationType, QString> typenames;
typenames.insert(APM::PerformOperationType, "Perform type");
typenames.insert(APM::QueryOperationType, "Query type");
typenames.insert(APM::RemoveOperationType, "Remove type");
typenames.insert(APM::SyncOperationType, "Sync type");
typenames.insert(APM::UpgradeOperationType, "Upgrade type");
typenames.insert(APM::NoType, "No type");
typenames.insert(APM::PerformOperationType, QObject::tr("Perform type"));
typenames.insert(APM::QueryOperationType, QObject::tr("Query type"));
typenames.insert(APM::RemoveOperationType, QObject::tr("Remove type"));
typenames.insert(APM::SyncOperationType, QObject::tr("Sync type"));
typenames.insert(APM::UpgradeOperationType, QObject::tr("Upgrade type"));
typenames.insert(APM::NoType, QObject::tr("No type"));
out << "Usage: " << m_data.catalogName() << " operation [options] [arguments]." << endl;
out << QObject::tr("Usage: ") << m_data.catalogName() << QObject::tr(" operation [options] [arguments].") << endl;
out << endl;
out << m_data.shortDescription();
out << endl << endl;
out << "Akabei operations:" << endl;
out << QObject::tr("Akabei operations:") << endl;
foreach (APM::OperationType type, typenames.keys()) {
if (!m_acceptedOperations.values(type).isEmpty()) {
......@@ -111,7 +111,7 @@ void CommandLineUtils::printHelpMessage(QMultiHash<APM::OperationType, AkabeiOpe
}
out << endl;
out << "Akabei options:" << endl;
out << QObject::tr("Akabei options:") << endl;
foreach (const AkabeiOption& opt, m_acceptedOptions.toSet()) {
/*
......@@ -178,13 +178,13 @@ void CommandLineUtils::printVersion(AkabeiAboutData &m_data)
void CommandLineUtils::printAuthors(AkabeiAboutData &m_data)
{
QTextStream out(stdout);
out << m_data.appName() << " was written by" << endl;
out << m_data.appName() << QObject::tr(" was written by") << endl;
foreach (const AkabeiAuthor& dev, m_data.authors()) {
out << " " << dev.name() << " " << dev.emailAddress() << endl;
}
out << "Please use " << m_data.bugAddress() << " to report bugs." << endl;
out << QObject::tr("Please use ") << m_data.bugAddress() << QObject::tr(" to report bugs.") << endl;
exit(0);
}
......
......@@ -72,10 +72,10 @@ void QueueOperation::start(AkabeiClient::PackageAction action, QList<Akabei::Pac
QString errorDescription;
if (action == AkabeiClient::Remove) {
errorDescription = "Unable to find the requested package(s) among the installed ones. Quitting...";
errorDescription = QObject::tr("Unable to find the requested package(s) among the installed ones. Quitting...");
}
else {
errorDescription = "Unable to find the requested package(s). Quitting...";
errorDescription = QObject::tr("Unable to find the requested package(s). Quitting...");
}
QTextStream err(stderr);
......
#
# /etc/akabei.conf
#
# See the akabei.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
RootDir = YOURPATH/buildroot/_chroots/master-x64/
DatabaseDir = YOURPATH/buildroot/databases/
CacheDir = YOURPATH/buildroot/_cache-x64/
#LogFile = /var/log/akabei.log
HoldPkg = akabei glibc
# If upgrades are available for these packages they will be asked for first
SyncFirst = akabei
###CleanMethod = KeepInstalled
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options (all disabled by default)
#NoPassiveFtp
#UseSyslog
#ShowSize
##TotalDownload
#
# REPOSITORIES
# - can be defined here or included from another file
# - akabei will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
[core]
Server = http://rsync.chakraos.org/packages/core/x86_64
[platform]
Server = http://rsync.chakraos.org/packages/platform/x86_64
[desktop]
Server = http://rsync.chakraos.org/packages/desktop/x86_64
#[apps]
#Server = http://rsync.chakraos.org/packages/apps/x86_64
#[lib32]
#Server = http://rsync.chakraos.org/packages/lib32/x86_64
#!/bin/bash
#
# atf.sh, an automatic Akabei testing framework Chakra GNU/Linux
#
# Basen on a-setup.sh by the Chakra Team
# GPL
# version
VER="0.2"
# local root name (safe to change)
BASENAME="buildroot"
# dir vars
CURDIR="${PWD}"
BASEPATH="${CURDIR}/${BASENAME}"
# argument vars
REPO="core"
BRANCH="master"
COMMITMODE="n"
ARCH="x64"
CARCH="x86_64"
# user vars
USERID="$(getent passwd "${USER}" | cut -d: -f3)"
# Remote paths
PKGSOURCE="http://rsync.chakraos.org/packages"
# setup local root dir
PM_BIN="pacman"
PM_CONF="pacman.conf"
mkdir -p "${BASEPATH}"
REPO_NAME="${REPO}"
CHROOT="${BASEPATH}/_chroots/$BRANCH-${ARCH}"
CHAKRAFOLDER="chakra"
CHAKRADIR="${CHROOT}/${CHAKRAFOLDER}"
REPODIR="${CHAKRADIR}/${REPO_NAME}"
# Pkgs to install
INSTALLPKGS=('base' 'base-devel' 'cmake' 'openssh' 'git' 'sudo' 'boost' 'vim'
'rsync' 'squashfs-tools' 'curl' 'libusb-compat'
'gnupg' 'cdrkit' 'bash-completion' 'akabei')
#
# formatted output functions
#
title() {
local mesg="${1}"; shift
echo " "
printf "\033[1;33m>>>\033[1;0m\033[1;1m ${mesg}\033[1;0m\n"
echo " "
}
msg() {
local mesg="${1}"; shift
echo -e "\033[1;32m::\033[1;0m\033[1;0m ${mesg}\033[1;0m"
}
question() {
local mesg="${1}"; shift
echo -e -n "\033[1;32m::\033[1;0m\033[1;0m ${mesg}\033[1;0m"
}
notice() {
local mesg="${1}"; shift
echo -e -n ":: ${mesg}\n"
}
warning() {
local mesg="${1}"; shift
printf "\033[1;33m::\033[1;0m\033[1;1m ${mesg}\033[1;0m\n"
}
error() {
local mesg="${1}"; shift
printf "\033[1;31m::\033[1;0m\033[1;0m ${mesg}\033[1;0m\n"
}
newline() {
echo
}
status_start() {
local mesg="${1}"; shift
echo -e -n "\033[1;32m::\033[1;0m\033[1;0m ${mesg}\033[1;0m"
}
status_ok() {
echo -e "\033[1;32m OK \033[1;0m"
}
status_done() {
echo -e "\033[1;32m DONE \033[1;0m"
}
banner() {
newline
printf '\e[1;36m'
echo " .,-::::: :: .: :::. ::: . :::::::.. :::. "
echo ",;;;'\`\`\`\`' ,;; ;;, ;;\`;; ;;; .;;,.;;;;\`\`;;;; ;;\`;; "
echo "[[[ ,[[[,,,[[[ ,[[ '[[, [[[[[/' [[[,/[[[' ,[[ '[[, "
echo " \$\$\$ \"\$\$\$\"\"\"\$\$\$c\$\$\$cc\$\$\$c _\$\$\$\$, $\$\$\$\$\$c c\$\$\$cc\$\$\$c "
echo "\`88bo,__,o, 888 \"88o888 888,\"888\"88o, 888b \"88bo,888 888,"
echo " YUMMMMMP\"MMM YMMYMM \"\"\` MMM \"MMP\" MMMM \"W\" YMM \"\"\` "
printf '\e[0m'
newline
}
#
# check distro and needed packages
#
if [ ! -e "/usr/bin/git" ] ; then
newline
error "this script needs the package GIT installed, please install it before continuing."
newline
exit
fi
#
# {u,}mount chroot's {dev,sys,proc,cache} functions
#
mount_special() {
sudo mount -v /dev "${CHROOT}/dev" --bind &>/dev/null
sudo mount -v /sys "${CHROOT}/sys" --bind &>/dev/null
sudo mount -v /proc "${CHROOT}/proc" --bind &>/dev/null
sudo mount -v "${BASEPATH}/_cache-${CARCH}" "${CHROOT}/var/cache/pacman/pkg" --bind &>/dev/null
}
umount_special() {
sudo umount -v "${CHROOT}/dev" &>/dev/null
sudo umount -v "${CHROOT}/sys" &>/dev/null
sudo umount -v "${CHROOT}/proc" &>/dev/null
sudo umount -v "${CHROOT}/var/cache/pacman/pkg" &>/dev/null
}
#
# generate a pacman manager conf
#
create_pacmanconf() {
newline
msg "creating ${PM_CONF}"
echo >> "${BASEPATH}/${PM_CONF}"
echo "[options]" >> "${BASEPATH}/${PM_CONF}"
echo "HoldPkg=pacman glibc" >> "${BASEPATH}/${PM_CONF}"
echo "SigLevel=Never" >> "${BASEPATH}/${PM_CONF}"
echo >> "${BASEPATH}/${PM_CONF}"
local PACREPO
for PACREPO in testing core platform desktop; do
echo "[${PACREPO}]" >> ${BASENAME}/${PM_CONF}
echo "Server=${PKGSOURCE}/${PACREPO}/${CARCH}/" >> ${BASENAME}/${PM_CONF}
echo >> ${BASENAME}/${PM_CONF}
done
}
#
# chroot creation functions
#
check_chroot() {
if [ -d "${CHROOT}" ] ; then
newline
error "The chroot ${BRANCH}-${ARCH} already exists. Do you want to"
newline
msg "(k)eep chroot ${BRANCH}-${ARCH} and update it?"
msg "(d)elete/reinstall chroot ${BRANCH}-${ARCH}?"
msg "(u)ninstall chroot ${BRANCH}-${ARCH}?"
question "(q)uit this script? "
read OPTION
case "${OPTION}" in
d* )
newline
status_start "chroot ${BRANCH}-${ARCH} "
cd "${BASEPATH}"
sudo -v
sudo rm -rf -v "${CHROOT}" &>/dev/null
sudo rm -rf -v "${BASEPATH}/${REPO_NAME}-${CARCH}" &>/dev/null
sudo -v
status_done
;;
u* )
newline
status_start "uninstalling ${REPO_NAME}-${CARCH} "
cd "${BASEPATH}"
sudo -v
sudo rm -rf -v "${CHROOT}" &>/dev/null
sudo rm -rf -v "${BASEPATH}/${REPO_NAME}-${CARCH}" &>/dev/null
sudo -v
status_done
newline
exit 1
;;
k* )
newline
msg "going on ..."
newline
;;
q* )
newline
msg "bye!"
newline
exit 1
;;
esac
fi
if [ -d "${BASEPATH}/${REPO_NAME}-${CARCH}" ] ; then
newline
error "The ${REPO_NAME}-${CARCH} already exists. Do you want to"
newline
msg "(d)elete and reinstall ${REPO_NAME}-${CARCH}?"
msg "(u)ninstall ${REPO_NAME}-${CARCH}?"
question "(q)uit this script? "
read OPTION
case "${OPTION}" in
d* )
newline
status_start "deleting ${REPO_NAME}-${CARCH} "
uninstall_chroot
status_done
;;
u* )
newline
status_start "uninstalling ${REPO_NAME}-${CARCH} "
uninstall_chroot
status_done
newline
exit 1
;;
q* )
newline
msg "bye!"
newline
exit 1
;;
esac
fi
}
uninstall_chroot() {
cd "${BASEPATH}"
# Umount stuff.
sudo umount -v "${CHROOT}/dev" &>/dev/null
sudo umount -v "${CHROOT}/sys" &>/dev/null
sudo umount -v "${CHROOT}/proc" &>/dev/null
sudo umount -v "${CHROOT}/var/cache/pacman/pkg" &>/dev/null
sudo rm -rf -v "${BASEPATH}/${REPO_NAME}-${CARCH}" &>/dev/null
sudo -v
}
pre_install_packages() {
newline
title "Creating chroot: ${REPO_NAME}-${CARCH}"
newline
status_start "creating special dirs"
mkdir -p "${CHROOT}"/{dev,sys,proc,var/cache/pacman/pkg}
status_done
status_start "mounting special dirs"
mount_special
status_done
status_start "creating pacman dirs"
mkdir -p "${CHROOT}/var/lib/pacman" &>/dev/null
status_done
}
install_packages() {
if [ "${_creationLoop}" == "1" ] ; then
unset _creationLoop
warning "Seems some went wrong. Check the pacman install log!"
newline
if [ "$_updateRet" == "1" ] ; then
msg "(r)etry package update?"
msg "(s)kip package update at your own risk?"
else
msg "(r)etry package installation?"
msg "(s)kip package installation at your own risk?"
fi
question "(q)uit this script? "
read OPTION
case "${OPTION}" in
r* )
newline
if [ "${_updateRet}" == "1" ] ; then
msg "retrying package update"
else
msg "retrying package installation"
fi
sleep 4
install_packages
;;
s* )
newline
if [ "${_updateRet}" == "1" ] ; then
msg "skipping package update"
else
msg "skipping package installation"
fi
return 0
;;
q* )
umount_special
rm -f "${BASEPATH}/${PM_CONF}"
newline
msg "bye!"
newline
exit 1
;;
esac
fi
sudo -v
newline
# Theorically if the user exists the chroot as been created
if [ "${_installDone}" != "1" ] ; then
if [ -d "${CHROOT}/home/${USER}" ] ; then
msg "updating chroot ${BRANCH}-${ARCH}"
unset _installDone
unset _updateRet
unset _creationLoop
sudo LC_ALL=C "${PM_BIN}" --noconfirm --needed --config "${BASEPATH}/${PM_CONF}" -r "${CHROOT}" --cachedir "${BASEPATH}/_cache-${ARCH}" -Syyu || _updateRet="1"
if [ "${_updateRet}" == "1" ] ; then
error "!! failed to update the chroot (not good)..."
_creationLoop="1"
install_packages
else
_installDone="1"
fi
else
msg "installing chroot ${BRANCH}-${ARCH}"
unset _installDone
unset _installRet
unset _creationLoop
sudo LC_ALL=C "${PM_BIN}" --noconfirm --needed --config "${BASEPATH}/${PM_CONF}" -r "${CHROOT}" --cachedir "${BASEPATH}/_cache-${ARCH}" -Syy "${INSTALLPKGS[@]}" || _installRet="1"
if [ "${_installRet}" == "1" ] ; then
error "!! failed to install the needed packages..."
_creationLoop="1"
install_packages
else
_installDone="1"
fi
fi
fi
}
create_chroot() {
sudo -v
newline
status_start "configuring system"
mkdir -p "${CHROOT}/etc" &>/dev/null
sudo cp /etc/resolv.conf "${CHROOT}/etc" &>/dev/null
if [[ ! -f "${CHROOT}/etc/${PM_CONF}.bak" ]]; then
sudo mv "${CHROOT}/etc/${PM_CONF}"{,.bak}
sudo cp "${BASEPATH}/${PM_CONF}" "${CHROOT}/etc" &>/dev/null
fi
status_done
status_start "setting up locale.conf"
sudo touch "${CHROOT}/etc/locale.conf"
sudo chmod 777 "${CHROOT}/etc/locale.conf"
sudo echo "LANG=C" >> "${CHROOT}/etc/locale.conf"
sudo echo "LC_MESSAGES=C" >> "${CHROOT}/etc/locale.conf"
status_done
# search for a user already existing or create it
newline
if [ "$(grep "^${USER}:" "${CHROOT}/etc/passwd" | cut -d ":" -f1)" != "${USER}" ] ; then
title "User setup"
status_start "adding user: ${USER}"
sudo chroot "${CHROOT}" useradd -g users -u "${USERID}" -G audio,video,optical,storage,log -m "${USER}" &>/dev/null
status_done
warning "you will be asked to enter a password for the chroot's user account"
sudo -v
newline
sudo chroot "${CHROOT}" passwd "${USER}"
sudo -v
newline
status_start "setting up /etc/sudoers"
sudo chmod 777 "${CHROOT}/etc/sudoers"
sudo echo >> "${CHROOT}/etc/sudoers"
sudo echo "${USER} ALL=(ALL) NOPASSWD: ALL" >> "${CHROOT}/etc/sudoers"
sudo chmod 0440 "${CHROOT}/etc/sudoers"
status_done
else
msg "found user: ${USER}"
fi
status_start "setting up device permissions"
sudo chroot "${CHROOT}" chmod 777 /dev/console &>/dev/null
sudo chroot "${CHROOT}" chmod 777 /dev/null &>/dev/null
sudo chroot "${CHROOT}" chmod 777 /dev/zero &>/dev/null
status_done
status_start "unmounting special dirs"
umount_special
status_done
}
# initialize sudo and ssh
setup_ssh() {
if [ -e "/usr/bin/sudo" ] ; then
newline
warning "initializing sudo, you may be asked for your password"
newline
sudo /bin/true &>/dev/null
else
newline
error "please install and configure sudo"
newline
exit 1
fi
}
create_databasedir() {
mkdir -p $BASEPATH/databases
akabei-create-db generate $BASEPATH/databases/local.db $BASEPATH/_cache-x64/*
sudo chown root:root $BASEPATH/databases/local.db
sudo chmod g+r,o+r $BASEPATH/databases/local.db
sudo chown root:root $CHROOT
}
prepare_akabei_conf() {
title "Preparing akabei.conf ..."
wget -O akabei.conf https://gitorious.org/chakra/akabei/raw/master:scripts/akabei-test-chroot/akabei.conf
sed -i "s|YOURPATH|$(pwd)|g" ./akabei.conf
sudo mv ./akabei.conf /etc/akabei.conf
}
import_signatures() {
title "Importing Chakra signatures to akabei-keyring ..."
newline
sudo mkdir ./buildroot/_chroots/master-x64/etc/akabei.d/
sudo mkdir ./buildroot/_chroots/master-x64/etc/akabei.d/keyring/
sudo chmod go-r-x buildroot/_chroots/master-x64/etc/akabei.d/keyring/
sudo gpg --homedir ./buildroot/_chroots/master-x64/etc/akabei.d/keyring/ --trust-model always --import /usr/share/chakra/signatures/*.asc
for key in EBC85A93 26C56140 BF2412F9 02238B03 B6611E8A C51B9BC2 D417608D F906E3F4 4CA5A1FF 82AC496A; do
sudo gpg --homedir ./buildroot/_chroots/master-x64/etc/akabei.d/keyring --recv-keys --keyserver keys.gnupg.net $key
printf 'trust\n5\ny\quit\n' | sudo gpg --homedir ../buildroot/_chroots/master-x64/etc/akabei.d/keyring --no-permission-warning --command-fd 0 --edit-key $key