Compare commits
19 commits
Author | SHA1 | Date | |
---|---|---|---|
|
edac8c6141 | ||
|
9dce5b0a68 | ||
|
1d494b87ff | ||
|
f37d2a58d7 | ||
|
e115d7d554 | ||
|
ef4ccbef46 | ||
|
fad2ddd2c3 | ||
|
41d1ff0628 | ||
|
a713b01352 | ||
|
46cdedc6a2 | ||
|
95d746acf1 | ||
|
2b97b44e16 | ||
|
bbd1bec527 | ||
|
19838ae794 | ||
|
5bb6f377a4 | ||
|
28b70404cb | ||
|
46de0ea716 | ||
|
38614d26f4 | ||
|
06bba6f68f |
22 changed files with 353 additions and 145 deletions
|
@ -1,5 +1,3 @@
|
||||||
# aps
|
# APS
|
||||||
|
APS - Alnux Packaging System
|
||||||
|
|
||||||
the alnux package manager
|
|
||||||
|
|
||||||
(the code is completely and utterly horrible and i cant believe i actually wrote this lol)
|
|
2
altools/README.md
Normal file
2
altools/README.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# This follows the UNIX philosophy
|
||||||
|
Actually, also altools is meant to be in shell since it's ok
|
32
altools/alinitsys
Executable file
32
altools/alinitsys
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#############
|
||||||
|
# ALINITSYS #
|
||||||
|
#############
|
||||||
|
|
||||||
|
# ALINITSYS is a passthrough to RUNIT OR OPENRC, if RUNIT OR OPENRC exists, if not, then ALINITSYS will wrap it up and init the system.
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
exec runit && echo ":: Running Runit..." || echo ":: Runit not found..." ;
|
||||||
|
exec openrc && echo ":: Running OpenRC..." || echo ":: OpenRC not found..." ;
|
||||||
|
echo ":: Running alinitsys"
|
||||||
|
}
|
||||||
|
function rescue(){
|
||||||
|
echo "[E] Something might've went wrong..."
|
||||||
|
echo ":: Dropping into the SH"
|
||||||
|
exec sh
|
||||||
|
}
|
||||||
|
function daemon(){
|
||||||
|
/var/service/*/start
|
||||||
|
}
|
||||||
|
function getty(){
|
||||||
|
echo ":: Getting TTY"
|
||||||
|
exec getty || exec stty
|
||||||
|
}
|
||||||
|
function start(){
|
||||||
|
init ||
|
||||||
|
daemon &&
|
||||||
|
getty ||
|
||||||
|
rescue
|
||||||
|
}
|
||||||
|
start
|
5
altools/c/Makefile
Normal file
5
altools/c/Makefile
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
ccflags = -O3
|
||||||
|
compile:
|
||||||
|
gcc $(ccflags) pow.c -o pow
|
||||||
|
clean:
|
||||||
|
rm pow
|
BIN
altools/c/pow
Executable file
BIN
altools/c/pow
Executable file
Binary file not shown.
28
altools/c/pow.c
Normal file
28
altools/c/pow.c
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/reboot.h>
|
||||||
|
|
||||||
|
int main (int argc, char *argv[]) {
|
||||||
|
if (geteuid() != 0) {
|
||||||
|
printf("[E] pow must be run as root\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sync();
|
||||||
|
|
||||||
|
switch (argv[1] ? argv[1][0]: 0) {
|
||||||
|
case 's':
|
||||||
|
case 'p':
|
||||||
|
reboot(RB_POWER_OFF);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case 'r':
|
||||||
|
reboot(RB_AUTOBOOT);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
default:
|
||||||
|
printf("pow r[eboot]|p[oweroff]|s[hutdown]\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
12
altools/chroot-al
Normal file
12
altools/chroot-al
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
mount -t proc /proc $1/proc
|
||||||
|
mount -t sysfs /sys $1/sys
|
||||||
|
mount -o bind /dev $1/dev
|
||||||
|
mount -o bind /run $1/run
|
||||||
|
mount -o bind /sys/firmware/efi/efivars $1/sys/firmware/efi/efivars
|
||||||
|
cp /etc/resolv.conf $1/etc/resolv.conf
|
||||||
|
export MAKEFLAGS="-j$(nproc)"
|
||||||
|
export CFLAGS="-O2 -pipe -march-native"
|
||||||
|
export CXXFALGS="${CFLAGS}"
|
||||||
|
chroot $1 /bin/sh
|
18
altools/dae
Executable file
18
altools/dae
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# DAE, the deamon manager #
|
||||||
|
###########################
|
||||||
|
|
||||||
|
function daemonctl(){
|
||||||
|
case $1 in
|
||||||
|
stop) . /etc/al/serivces/$2.alsysd
|
||||||
|
stop ;;
|
||||||
|
start) . /etc/al/services/$2.alsysd
|
||||||
|
start ;;
|
||||||
|
esac
|
||||||
|
case $2 in
|
||||||
|
--verbose) set -x ;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
}
|
4
altools/mkaltar
Executable file
4
altools/mkaltar
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
export AL_CFG="../config/config"
|
||||||
|
export AL_REPO="/var/tmp/alroot/var/aps/repos/official"
|
||||||
|
../aps s alnux
|
13
altools/mkinitramfs
Executable file
13
altools/mkinitramfs
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
###############
|
||||||
|
# MKINITRAMFS #
|
||||||
|
###############
|
||||||
|
|
||||||
|
if [ ! -d /usr/src/initramfs ]; then
|
||||||
|
mkdir -p /usr/src/initramfs/{bin,dev,etc,lib,lib64,mnt/root,proc,root,sbin,sys}
|
||||||
|
cp --archive /dev/{null,console,tty,sd*} /usr/src/initramfs/dev/
|
||||||
|
cp --archive /bin/busybox /usr/src/initramfs/bin/busybox
|
||||||
|
fi
|
||||||
|
cd /usr/src/initramfs
|
||||||
|
find . -print0 | cpio --null --create --verbose --format=newc | gzip --best > /boot/initramfs.cpio.gz
|
BIN
altools/pow
Executable file
BIN
altools/pow
Executable file
Binary file not shown.
|
@ -6,13 +6,13 @@
|
||||||
. /etc/al/config
|
. /etc/al/config
|
||||||
case $1 in
|
case $1 in
|
||||||
# add a repo
|
# add a repo
|
||||||
add) git clone https://${3}/${2}.git ${install_root}/var/aps/repos/${2}
|
add) git clone ${2} ${install_root}/var/db/repos
|
||||||
echo "${2}" >> ${install_root}/etc/al/repo.conf
|
echo "${2}" >> ${install_root}/etc/al/repo.conf
|
||||||
;;
|
;;
|
||||||
# update a repo
|
# update a repo
|
||||||
update) pushd && cd ${install_root}/var/aps/repos/${2} && git pull && popd ;;
|
update) pushd && cd ${install_root}/var/aps/repos/${2} && git pull && popd ;;
|
||||||
# destroy a repo (remove)
|
# destroy a repo (remove)
|
||||||
destroy) rm -rfv ${install_root}/var/aps/repos/${2}
|
destroy) rm -rfv ${install_root}/var/db/aps/repos/${2}
|
||||||
sed -i "/^${2}/d" ${install_root}/etc/al/repo.conf
|
sed -i "/^${2}/d" ${install_root}/etc/al/repo.conf
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
274
aps
274
aps
|
@ -1,17 +1,26 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#################################
|
###################
|
||||||
# Alnux Packaging System, #
|
# aps. rewritten. #
|
||||||
# the package manager for Alnux #
|
###################
|
||||||
#################################
|
# OHIO: aps *needs* to be rewritten, i can't add any thing else in the aps (v0.0.8.1)
|
||||||
|
# OHIO: aps is rewritten in 9/10th's so it's no longer a debug build
|
||||||
|
# OHIO: it's rewritten however it has some old code from aps (v0.0.8.1)
|
||||||
|
# KEMAL: abandon all hope, ye who enter here.
|
||||||
|
# OHIO: ^, however my code is cleaner than the mess before.
|
||||||
|
function conf_fetch(){
|
||||||
if [ -f "$XDG_CONFIG_HOME/al/config" ]; then
|
if [ -f "$XDG_CONFIG_HOME/al/config" ]; then
|
||||||
. $XDG_CONFIG_HOME/al/config
|
. $XDG_CONFIG_HOME/al/config
|
||||||
elif [ -f "$HOME/.config/al/config" ]; then
|
elif [ -f "$HOME/.config/al/config" ]; then
|
||||||
. $HOME/.config/al/config
|
. $HOME/.config/al/config
|
||||||
elif [ -f "/etc/al/config" ]; then
|
elif [ -f "/etc/al/config" ]; then
|
||||||
. /etc/al/config
|
. /etc/al/config
|
||||||
|
elif [ -f "/etc/skel/al/config" ]; then
|
||||||
|
. /etc/skel/al/config
|
||||||
|
#elif [ -f $AL_CFG ]; then
|
||||||
|
# . $AL_CFG
|
||||||
else
|
else
|
||||||
|
wrn "No config file!"
|
||||||
temp_location="/var/tmp"
|
temp_location="/var/tmp"
|
||||||
install_root="/var/tmp/alroot"
|
install_root="/var/tmp/alroot"
|
||||||
installed_pkg_database="${install_root}/var/aps/installed"
|
installed_pkg_database="${install_root}/var/aps/installed"
|
||||||
|
@ -19,132 +28,171 @@ else
|
||||||
lock="${install_root}/var/aps/lock"
|
lock="${install_root}/var/aps/lock"
|
||||||
official="https://git.hippoz.xyz/alnux/repo"
|
official="https://git.hippoz.xyz/alnux/repo"
|
||||||
debug=off
|
debug=off
|
||||||
|
#echo $AL_REPO
|
||||||
|
#AL_REPO=$(echo $AL_REPO | cut -d':')
|
||||||
|
#echo $AL_REPO
|
||||||
fi
|
fi
|
||||||
if [ ${debug} = on ]; then
|
}
|
||||||
set -x
|
case ${debug} in
|
||||||
fi
|
on) set -x ;;
|
||||||
die() {
|
esac
|
||||||
echo "aps: fatal: ${1}"
|
function prn(){
|
||||||
rm "${lock}"
|
echo -e "\e[34m==>\e[39m $1"
|
||||||
|
}
|
||||||
|
function wrn(){
|
||||||
|
echo -e "\e[34m==>\e[33m WARNING:\e[39m $1"
|
||||||
|
}
|
||||||
|
function err(){
|
||||||
|
echo -e "\e[34m==>\e[31m ERROR:\e[39m $1" &&
|
||||||
|
rm ${lock} 2> /dev/null
|
||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
confirm(){
|
conf_fetch
|
||||||
echo -ne "Are you sure? [Y/n] "
|
function notf(){
|
||||||
read prompt
|
echo -e "\e[34m==>\e[36m NOTIFICATION:\e[39m $1"
|
||||||
if [[ ${prompt} = [nN] ]]; then
|
}
|
||||||
die "User said no. Exiting..."
|
function confirm(){
|
||||||
elif [[ ${prompt} != [yY] ]]; then
|
prn "To continue press ENTER, or to exit CTRL-C"
|
||||||
die "User gave invalid input. Exiting..."
|
read -p
|
||||||
|
}
|
||||||
|
function sources(){
|
||||||
|
pkg_config_url="$1"
|
||||||
|
pkg_config_url_prefix=$(echo ${pkg_config_url} | cut -d'+' -f1)
|
||||||
|
pkg_config_url_rest=$(echo ${pkg_config_url} | cut -d+ -f2)
|
||||||
|
case $pkg_config_url_prefix in
|
||||||
|
git) mkdir pkgsrc && git clone ${pkg_config_url_rest} pkgsrc ;;
|
||||||
|
web) pkg_config_archv=$(echo ${pkg_config_url} | sed 's:.*/::')
|
||||||
|
curl -fLO "${pkg_config_url_rest}"
|
||||||
|
mkdir --parents pkgex
|
||||||
|
pkg_config_archv_ft=$(file --extension ${pkg_config_archv_ft})
|
||||||
|
case $pkg_config_archv_ft in
|
||||||
|
*.tar*) prn $(tar -xf ${pkg_config_archv} -C pkgex) ;;
|
||||||
|
*.xz) prn $(cd pkgex && xz -d ../${pkg_config_archv} && cd ..) ;;
|
||||||
|
*.bz2) prn $(cd pkgex && bzip2 -d ../${pkg_config_archv} && cd ..) ;;
|
||||||
|
*.gz) cd pkgex && gzip -d ../${pkg_config_archv} && cd .. ;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
mkdir --parents pkgsrc
|
||||||
|
cp -r pkgex/*/* pkgsrc ;;
|
||||||
|
*) err "Old Alnux sources is probably used!"
|
||||||
|
esac
|
||||||
|
|
||||||
|
}
|
||||||
|
function sha256(){
|
||||||
|
#sha256sum $sum > $1.sha256sum
|
||||||
|
sha256sum -c "$1" 1>&2 /dev/null
|
||||||
|
if [ "$?" -eq "0" ]; then
|
||||||
|
prn "OK!"
|
||||||
|
else
|
||||||
|
err "Sha failed!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
run_package_script() {
|
function runbuildsh(){
|
||||||
{
|
|
||||||
if [ -x "${2}/${1}" ]; then
|
if [ -x "${2}/${1}" ]; then
|
||||||
echo ":: Running ${1}"
|
prn "Running $1"
|
||||||
#cd "${2}" || die "Could not enter package working directory. Exiting..."
|
cd "${2}" || err "Running $1 has failed, check your permissions."
|
||||||
"${2}/${1}" "${2}/payload" "${2}"
|
"${2}/${1}" "${2}/payload" "${2}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
function pkg_find(){
|
||||||
|
# i could not even bother, i had to copy kiss in some sense
|
||||||
|
set -- "$1" "$2" "$3" "${4:-"$AL_REPO"}"
|
||||||
|
IFS=:
|
||||||
|
|
||||||
|
for _find_path in $4 "${3:-$sys_db}"; do set +f
|
||||||
|
for _find_pkg in "$_find_path/"$1; do
|
||||||
|
test "${3:--d}" "$_find_pkg" && set -f -- "$@" "$_find_pkg"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
unset IFS
|
||||||
|
# alnux search i guess
|
||||||
|
#case $2-$# in
|
||||||
|
# *-4) return 1 ;;
|
||||||
|
# -*) repo_dir=$5; repo_name=${5##*/} ;;
|
||||||
|
# *) shift 4; printf '%s\n' "$@"
|
||||||
|
#esac
|
||||||
}
|
}
|
||||||
install_local_package() {
|
function pkg_local(){
|
||||||
[ ! -e "${1}" ] && die "File ${1} does not exist. Exiting..."
|
#if [ -z "$AL_REPO" ]; then
|
||||||
# Extract the package
|
# err "Alnux Repo variable is not set. Will not continue"
|
||||||
confirm
|
#fi
|
||||||
echo ":: Installing package ${1}"
|
pkg_find $1
|
||||||
cp -prv "${1}" "${temp_location}"
|
cp -prv "${1}" "${temp_location}"
|
||||||
|
|
||||||
|
# - - - - - #
|
||||||
|
# VARIABLES #
|
||||||
|
# - - - - - #
|
||||||
pkg_name="${1%/}"
|
pkg_name="${1%/}"
|
||||||
pkg_name="${pkg_name##*/}"
|
pkg_name="${pkg_name##*/}"
|
||||||
pkg_name=$(echo "${pkg_name}" | cut -f 1 -d '.')
|
pkg_name=$(echo "${pkg_name}" | cut -f 1 -d '.')
|
||||||
pkg_path="${temp_location}/${pkg_name}"
|
pkg_path="${temp_location}/${pkg_name}"
|
||||||
cd "${pkg_path}" || die "Could not enter package path."
|
# - - #
|
||||||
# Set default values for package
|
# #
|
||||||
pkg_config_deploy=true
|
# - - #
|
||||||
pkg_config_ver="0"
|
|
||||||
pkg_config_makedepends=""
|
|
||||||
pkg_config_depends=""
|
|
||||||
# Download sources.
|
|
||||||
if [ -f sources ]; then
|
|
||||||
pkg_config_sources=$(cat sources)
|
|
||||||
pkg_config_sources_to=$(echo ${pkg_config_sources} | sed 's:.*/::')
|
|
||||||
curl -# ${pkg_config_sources} -o ${pkg_config_sources_to}
|
|
||||||
mkdir pkg_bd
|
|
||||||
tar -xf 1 ${pkg_config_sources_to} -C ${pkg_path}
|
|
||||||
fi
|
|
||||||
# Install package
|
|
||||||
mkdir -p "${pkg_path}/payload"
|
mkdir -p "${pkg_path}/payload"
|
||||||
. "${pkg_path}/package"
|
. "${pkg_path}/package"
|
||||||
cd pkg_bd/
|
cd "${pkg_path}"
|
||||||
run_package_script "build" "${pkg_path}"
|
if [ -f sources ]; then
|
||||||
cd ../..
|
sources "$(cat ${pkg_path}/sources)"
|
||||||
run_package_script "predeploy" "${pkg_path}"
|
#"$(cat *.sources)"
|
||||||
|
fi
|
||||||
|
# for SOURCES in *.sources; do sources "$(cat $SOURCES)"; done
|
||||||
|
for SHASUM in *.sha256sum; do sha256 "$(cat $SHASUM)"; done
|
||||||
|
runbuildsh "build" "${pkg_path}/pkgsrc"
|
||||||
|
runbuildsh "predeploy" "${pkg_path}/pkgsrc"
|
||||||
|
# Old APS code from before the rewrite!
|
||||||
# Deploy package
|
# Deploy package
|
||||||
if [ "${pkg_config_deploy}" = true ]; then
|
if [ "${pkg_config_deploy}" = true ]; then
|
||||||
echo ":: Deploying target ${pkg_name}..."
|
prn "Deploying target ${pkg_name}..."
|
||||||
cp -rpv "${pkg_path}/payload"/* "${install_root}" > "${temp_location}/${pkg_name}-payloaddeploylog"
|
cp -rpv "${pkg_path}/payload"/* "${install_root}" > "${temp_location}/${pkg_name}-payloaddeploylog"
|
||||||
sed 's/^.*-> //' "${temp_location}/${pkg_name}-payloaddeploylog" | tr -d \'\" > "${temp_location}/${pkg_name}-payloadfiles"
|
sed 's/^.*-> //' "${temp_location}/${pkg_name}-payloaddeploylog" | tr -d \'\" > "${temp_location}/${pkg_name}-payloadfiles"
|
||||||
rm "${temp_location}/${pkg_name}-payloaddeploylog"
|
rm "${temp_location}/${pkg_name}-payloaddeploylog"
|
||||||
fi
|
fi
|
||||||
run_package_script "postdeploy" "${pkg_path}"
|
runbuildsh "postdeploy" "${pkg_path}/pkgsrc"
|
||||||
# Add package to database
|
# Yet more old APS code
|
||||||
if [ -x "${pkg_path}/package" ]; then
|
if [ -x "${pkg_path}/package" ]; then
|
||||||
echo ":: Adding target ${pkg_name} to installed package database..."
|
prn "Adding target ${pkg_name} to installed package database..."
|
||||||
[ ! -d "${installed_pkg_database}/${pkg_name}" ] && mkdir "${installed_pkg_database}/${pkg_name}"
|
[ ! -d "${installed_pkg_database}/${pkg_name}" ] && mkdir -p "${installed_pkg_database}/${pkg_name}"
|
||||||
cp -pv "${pkg_path}/package" "${installed_pkg_database}/${pkg_name}/package"
|
cp -pv "${pkg_path}/package" "${installed_pkg_database}/${pkg_name}/package"
|
||||||
[ -e "${temp_location}/${pkg_name}-payloadfiles" ] && cp -pv "${temp_location}/${pkg_name}-payloadfiles" "${installed_pkg_database}/${pkg_name}/payloadfiles"
|
[ -e "${temp_location}/${pkg_name}-payloadfiles" ] && cp -pv "${temp_location}/${pkg_name}-payloadfiles" "${installed_pkg_database}/${pkg_name}/payloadfiles"
|
||||||
else
|
else
|
||||||
die "Target ${pkg_name} does not have a package script (it's an invalid package!). Exiting..."
|
err "Target ${pkg_name} does not have a package script (it's an invalid package!). Exiting..."
|
||||||
fi
|
fi
|
||||||
# Cleanup
|
# Old Cleanup, might work
|
||||||
rm -r "${pkg_path}"
|
rm -r "${pkg_path}"
|
||||||
rm "${temp_location}/${pkg_name}-payloadfiles"
|
rm "${temp_location}/${pkg_name}-payloadfiles"
|
||||||
cd "${install_root}" || die "Could not return to main directory. Exiting..."
|
cd "${install_root}" || err "Could not return to main directory. Exiting..."
|
||||||
unset pkg_path
|
unset pkg_path
|
||||||
unset pkg_name
|
unset pkg_name
|
||||||
unset pkg_config_deploy
|
unset pkg_config_deploy
|
||||||
unset pkg_config_ver
|
unset pkg_config_ver
|
||||||
unset pkg_config_makedepends
|
unset pkg_config_makedepends
|
||||||
unset pkg_config_depends
|
unset pkg_config_depends
|
||||||
echo "[*] Install complete for package ${pkg_name}"
|
prn "Install complete for package ${pkg_name}"
|
||||||
}
|
|
||||||
sync_deps(){
|
|
||||||
confirm
|
|
||||||
echo ":: Syncing dependencies for ${1}"
|
|
||||||
install_package_from_repo "${pkg_makedepends}"
|
|
||||||
install_package_from_repo "${pkg_deps}"
|
|
||||||
echo "[*] Install dependencies for ${1}"
|
|
||||||
|
|
||||||
}
|
|
||||||
remove_local_package() {
|
|
||||||
confirm
|
|
||||||
echo ":: Removing target ${1}..."
|
|
||||||
pkg_path="${installed_pkg_database}/${1}"
|
|
||||||
[ ! -d "${pkg_path}" ] && die "Package could not be found in local installed package database. Exiting..."
|
|
||||||
payloadfiles_path="${pkg_path}/payloadfiles"
|
|
||||||
[ ! -e "${payloadfiles_path}" ] && die "[E] Package ${1} does not have a payloadfiles file. Exiting..."
|
|
||||||
rm -rv "$(cat ${payloadfiles_path})"
|
|
||||||
rm -rv "${pkg_path}"
|
|
||||||
echo "[*] Removal complete for target ${pkg_name}"
|
|
||||||
}
|
}
|
||||||
sync_local_repo_database() {
|
sync_local_repo_database() {
|
||||||
echo ":: Syncing local database for repo ${1}"
|
# Local database for repo already exists - sync it
|
||||||
|
#cd "${1}" || err "Could not enter local database directory. Exiting..."
|
||||||
|
#git pull
|
||||||
|
prn "Syncing local database for $1"
|
||||||
if [ ! -d "${locpkg_database}/${1}" ]; then
|
if [ ! -d "${locpkg_database}/${1}" ]; then
|
||||||
# Local database for repo doesnt exists - clone it
|
# Local database for repo doesnt exists - clone it
|
||||||
git clone "${2}" "${locpkg_database}/${1}"
|
git clone "${2}" "${locpkg_database}/${1}"
|
||||||
else
|
else
|
||||||
# Local database for repo already exists - sync it
|
# Local database for repo already exists - sync it
|
||||||
cd "${locpkg_database}/${1}" || die "Could not enter local database directory. Exiting..."
|
cd "${locpkg_database}/${1}" || err "Could not enter local database directory. Exiting..."
|
||||||
git pull
|
git pull
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
install_package_from_repo(){ # NOTE(hippoz): This can get a tad confusing... ${1} is the repo and ${2} is the package
|
install_package_from_repo(){ # NOTE(hippoz): This can get a tad confusing... ${1} is the repo and ${2} is the package
|
||||||
echo ":: Installing package ${2} from ${1} repo"
|
prn "Installing package(s) ${2} from ${1} repo"
|
||||||
[ ! -d "${locpkg_database}/${1}/${2}" ] && die "Target not found."
|
pkg_local "${locpkg_database}/${1}/${2}"
|
||||||
install_local_package "${locpkg_database}/${1}/${2}"
|
[ ! -d "${locpkg_database}/${1}/${2}" ] && err "Target not found."
|
||||||
}
|
}
|
||||||
upgrade() {
|
update() {
|
||||||
confirm
|
prn "Upgrading installed packages"
|
||||||
echo ":: Upgrading installed packages"
|
cd "${installed_pkg_database}" || err "Could not enter local installed package database directory. Exiting..."
|
||||||
cd "${installed_pkg_database}" || die "Could not enter local installed package database directory. Exiting..."
|
|
||||||
for pkg in */; do
|
for pkg in */; do
|
||||||
installed_pkg_path="${installed_pkg_database}/${pkg}"
|
installed_pkg_path="${installed_pkg_database}/${pkg}"
|
||||||
. "${installed_pkg_path}/package"
|
. "${installed_pkg_path}/package"
|
||||||
|
@ -163,46 +211,36 @@ upgrade() {
|
||||||
unset pkg_config_depends
|
unset pkg_config_depends
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
version(){
|
function help(){
|
||||||
echo "Alnux APS v0.0.8.1"
|
prn "h|help) prints this message"
|
||||||
|
prn "v|version) version"
|
||||||
|
prn "s|sync) install package(s), and sync repositories"
|
||||||
|
prn "u|update) update"
|
||||||
|
prn "i|install) install LOCAL package(s)"
|
||||||
}
|
}
|
||||||
help(){
|
function version(){
|
||||||
echo "Alnux APS, the packaging system for Alnux."
|
prn "APS Version 0.1.0"
|
||||||
echo ""
|
|
||||||
echo "sync - Synchronizes from package repository."
|
|
||||||
echo "install - Installs from local package information file and build file."
|
|
||||||
echo "upgrade - Upgrades from package repository."
|
|
||||||
echo "remove - Removes a package from /var/aps/installed and it's install files (payloadfiles)."
|
|
||||||
echo "list - Lists currently installed packages."
|
|
||||||
echo "help - Display this message."
|
|
||||||
echo "version - Display the version."
|
|
||||||
}
|
}
|
||||||
list(){
|
function main(){
|
||||||
ls ${installed_pkg_database} | sed 's/^README.md//g'
|
|
||||||
}
|
|
||||||
main() {
|
|
||||||
if [ -f "${lock}" ]; then
|
if [ -f "${lock}" ]; then
|
||||||
echo "A lock file already exists (another instance of the package manager could be running). If you're sure no package manager is running, remove the file ${lock}."
|
err "A lock file already exists (another instance of the package manager could be running). If you're sure no package manager is running, remove the file ${lock}."
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
touch "${lock}"
|
touch "${lock}"
|
||||||
case ${1} in
|
case $1 in
|
||||||
install) install_local_package "${2}" ;;
|
s|sync) sync_local_repo_database "${official}" ${official}
|
||||||
remove) remove_local_package "${2}" ;;
|
|
||||||
#sync-dep)
|
|
||||||
# sync_local_repo_database "official" ${official}
|
|
||||||
# [ -z "${2}" ] && exit 0
|
|
||||||
# install_package_from_repo "official" "${2}" ;;
|
|
||||||
sync)
|
|
||||||
sync_local_repo_database "official" ${official}
|
|
||||||
[ -z "${2}" ] && exit 0
|
[ -z "${2}" ] && exit 0
|
||||||
install_package_from_repo "official" "${2}" ;;
|
install_package_from_repo "${official}" "${@: -1}"
|
||||||
upgrade) upgrade "official" ;;
|
confirm ;;
|
||||||
help) help ;;
|
i|install) pkg_local ${*: -1}
|
||||||
version) version ;;
|
confirm ;;
|
||||||
list) list ;;
|
u|update) update
|
||||||
*) die "Invalid option ${1}, exiting..." ;;
|
confirm ;;
|
||||||
|
v|version) version ;;
|
||||||
|
h|help) help ;;
|
||||||
|
apsinst) if [ $APS_PKG=y ]; then
|
||||||
|
install -v aps
|
||||||
|
*) err "Invalid option"
|
||||||
esac
|
esac
|
||||||
rm "${lock}"
|
rm ${lock}
|
||||||
}
|
}
|
||||||
main "${1}" "${2}"
|
main $1 ${@: -1}
|
|
@ -4,7 +4,7 @@
|
||||||
# Alnux Packaging System #
|
# Alnux Packaging System #
|
||||||
##########################
|
##########################
|
||||||
temp_location="/var/tmp"
|
temp_location="/var/tmp"
|
||||||
install_root="/"
|
install_root="/var/tmp/alroot"
|
||||||
installed_pkg_database="${install_root}/var/aps/installed"
|
installed_pkg_database="${install_root}/var/aps/installed"
|
||||||
locpkg_database="${install_root}/var/aps/repos"
|
locpkg_database="${install_root}/var/aps/repos"
|
||||||
lock="${install_root}/var/aps/lock"
|
lock="${install_root}/var/aps/lock"
|
||||||
|
|
10
man/alnux-pkg-standard.7.md
Normal file
10
man/alnux-pkg-standard.7.md
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
alnux-pkg-standard(7)
|
||||||
|
# APS/Alnux packaging standard
|
||||||
|
# file structure:
|
||||||
|
- build (Shell/DSL)
|
||||||
|
- sha256 (DSL, seperate files for every sum)
|
||||||
|
- sources (DSL, seperate files for every source)
|
||||||
|
- package (DSL, variable)
|
||||||
|
# expectations, and alnux:
|
||||||
|
alnux is probably a diffrent distro than KISS. So don't try to install KISS packages on AL.
|
||||||
|
|
BIN
man/aps.8.gz
BIN
man/aps.8.gz
Binary file not shown.
7
man/aps.8.md
Normal file
7
man/aps.8.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
aps(8)
|
||||||
|
# APS version 0.1.0
|
||||||
|
# Patching APS:
|
||||||
|
either make a (.diff, .patch., .fix) file, sign it, mail it, or
|
||||||
|
mail it without the patch file, just the fix. (Mail it to APS dev team of course.)
|
||||||
|
# Packaging:
|
||||||
|
visit alnux-pkg-standard.7 for further info.
|
4
man/chroot-al.1.md
Normal file
4
man/chroot-al.1.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
chroot-al(1)
|
||||||
|
# Alnux Chroot
|
||||||
|
Alnux chroot serves a simple purpose, portable to any system;
|
||||||
|
chroot into a system with rebinded system directories.
|
27
man/manmake.sh
Executable file
27
man/manmake.sh
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
# clean everything
|
||||||
|
function clean(){
|
||||||
|
set -x
|
||||||
|
rm aps.8
|
||||||
|
rm alnux-pkg-standard.7
|
||||||
|
rm sel.7
|
||||||
|
rm repo.7
|
||||||
|
rm mkinitramfs.8
|
||||||
|
rm chroot-al.1
|
||||||
|
}
|
||||||
|
function scdocbuild(){
|
||||||
|
set -x
|
||||||
|
scdoc < aps.8.md > aps.8
|
||||||
|
scdoc < alnux-pkg-standard.7.md > alnux-pkg-standard.7
|
||||||
|
scdoc < sel.7.md > sel.7
|
||||||
|
scdoc < repo.7.md > repo.7
|
||||||
|
scdoc < mkinitramfs.8.md > mkinitramfs.8
|
||||||
|
scdoc < chroot-al.1.md > chroot-al.1
|
||||||
|
}
|
||||||
|
function main(){
|
||||||
|
case $1 in
|
||||||
|
scdocbuild) scdocbuild ;;
|
||||||
|
clean) clean ;;
|
||||||
|
*) scdocbuild ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
main $1
|
3
man/mkinitramfs.8.md
Normal file
3
man/mkinitramfs.8.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mkinitramfs(7)
|
||||||
|
# mkinitramfs
|
||||||
|
Alnux's mkinitramfs, it does not accept ANY flags, it's just there to make the initramfs.
|
3
man/repo.7.md
Normal file
3
man/repo.7.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
repo(7)
|
||||||
|
# repo
|
||||||
|
Can be used to manage repositories for aps.
|
4
man/sel.7.md
Normal file
4
man/sel.7.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
sel(7)
|
||||||
|
# sel
|
||||||
|
A alnux select script, can be used for symlinking your linux version and to
|
||||||
|
write a linux package for aps.
|
Loading…
Reference in a new issue