feat: allow instalee self-installation

This commit is contained in:
xeruf 2022-10-13 12:46:58 +02:00
parent 2ede79a59c
commit 59998de87d
8 changed files with 30 additions and 11 deletions

View File

@ -135,11 +135,12 @@ and ideas that need to be fleshed out.
### Planned ### Planned
- detection mechanism for handlers and features - detection mechanism for handlers and features
(e.g. whether they support batching) (e.g. whether they support batching)
- Ability to use multiple repos, including remote ones
- Handle missing versions in older os version repos
- helper/hook for adding packages to groups upon install - helper/hook for adding packages to groups upon install
(at least for `pacman`) (at least for `pacman`)
- Ability to use multiple repos, including remote
- Log Installs for reuse - Log Installs for reuse
- AUR: Install man-page, Readme to /usr/share/doc
### Random TODOs ### Random TODOs
- Debug corner cases - Debug corner cases
@ -147,10 +148,10 @@ and ideas that need to be fleshed out.
- Run file in tempdir by default? - Run file in tempdir by default?
- Handler for downloaded scripts (e.g. passff-host, funkwhale) - Handler for downloaded scripts (e.g. passff-host, funkwhale)
#### Windows #### Windows Flow
- Install choco and git offline - Install choco and git offline
- Run in git bash - Run in git bash
- Use choco/choco-offline sources - TODO: Use choco-offline sources
### Flow ### Flow
This is a revamped concept This is a revamped concept

View File

@ -1,3 +1 @@
osmconvert osmium-tool
osmfilter
osmtogeojson

View File

@ -3,7 +3,7 @@
## DEFINITIONS ## DEFINITIONS
name="$(basename "$0")" name="$(basename "$0")"
self="$(realpath "$0")" self="$(realpath "$0")"
dir_home="$(find "$INSTALEE_HOME" "${XDG_CONFIG_HOME:-$HOME/.config}/$name" "$HOME/.$name" "$(realpath "$(dirname "$0")")" "$PWD" -maxdepth 0 2>/dev/null | head -1)" export dir_home="$(find "$INSTALEE_HOME" "${XDG_CONFIG_HOME:-$HOME/.config}/$name" "$HOME/.$name" "$(realpath "$(dirname "$0")")" "$PWD" -maxdepth 0 2>/dev/null | head -1)"
handlers="$dir_home/handlers.available" handlers="$dir_home/handlers.available"
dir_packages="$dir_home/packages" dir_packages="$dir_home/packages"
@ -55,7 +55,6 @@ installpkg() {
local ext="${name#$base}" local ext="${name#$base}"
local handler="$dir_home/handlers/$base" local handler="$dir_home/handlers/$base"
cd "$(mktemp -d --tmpdir=$execdir "$(basename $pkg_entry).XXXX")"
if test -d "$handler" if test -d "$handler"
then then
# This declaration needs to be ahead, otherwise it overrides failing exit codes # This declaration needs to be ahead, otherwise it overrides failing exit codes
@ -65,11 +64,11 @@ installpkg() {
args="${args:-$1}" args="${args:-$1}"
install="$(find "$handler" -name "install$ext" | head -1)" install="$(find "$handler" -name "install$ext" | head -1)"
destress " $install $args" destress " $install $args"
$install $args pkg_entry="$install $args"
else else
destress " running unhandled $pkg_entry" destress " running unhandled $pkg_entry"
$pkg_entry
fi fi
(cd "$(mktemp -d --tmpdir=$execdir "$(basename $pkg_entry).XXXX")"; $pkg_entry)
set +e set +e
break break
done done
@ -163,6 +162,7 @@ chmod +rx "$dir_home/handlers" -R
execdir=/tmp/instalee.$(date +%s) execdir=/tmp/instalee.$(date +%s)
mkdir -p $execdir mkdir -p $execdir
cd $execdir cd $execdir
destress "Running in $execdir"
exitcode=0 exitcode=0
while test $# -gt 0; do while test $# -gt 0; do

1
packages/dex/arch Normal file
View File

@ -0,0 +1 @@

17
packages/instalee/linux Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
set -eo pipefail
# From https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=instalee-git
_pkgname='instalee'
cd "$(readlink /proc/$(ps -o ppid= $(ps -o ppid= $PPID) | tr -d ' ')/cwd || $dir_home)"
pkgdir=/tmp
usrdir="${pkgdir}/usr/local"
bin="${usrdir}/bin"
sudo install -D --target-directory "${usrdir}/share/doc/${_pkgname}/" *.md
sudo install -D --target-directory "${usrdir}/share/man/man1/" "${_pkgname}.1"
sudo install -D --target-directory "$bin" "${_pkgname}"
pkgver="$(git describe --long --tags 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' || printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)")"
sudo sed -i "s/r%s.%s/version ${pkgver}/" "$bin/${_pkgname}"
echo -n "Installed "
$bin/instalee --version

0
packages/osmium-tool/apt Normal file
View File

1
packages/osmium-tool/aur Normal file
View File

@ -0,0 +1 @@

1
packages/sass/arch Normal file
View File

@ -0,0 +1 @@
dart-sass