mirror of
https://github.com/89luca89/distrobox.git
synced 2026-08-19 01:14:49 -05:00
Add install script and installation instructions
This commit is contained in:
@@ -16,25 +16,23 @@ All the props goes to them as they had the great idea to implement this stuff.
|
||||
## But what is a distrobox?
|
||||
|
||||
Distrobox is a tool for Linux operating systems, which allows the use of containerized command line environments.
|
||||
It is built on top of Podman and other standard container technologies from OCI.
|
||||
It is built on top of **podman** and other standard container technologies from OCI.
|
||||
|
||||
The intention is to provide a mutable environment on a host where the filesystem is immutable (like Suse's MicroOS, Fedora Silverblue, Endless OS or SteamOS3)
|
||||
The intention is to provide a mutable environment on a host where the file-system is immutable (like Suse's MicroOS, Fedora Silverblue, Endless OS or SteamOS3)
|
||||
or where the user doesn't have privileges to modify the host (non-sudo users for example)
|
||||
|
||||
So even if you're not a sudoer or your distro doesn't have access to a traditional package manager, you
|
||||
will still be able to perform your `apt/dnf/pacman/pkg/zypper` shenanigans.
|
||||
|
||||
The distrobox environment is based on an OCI image.
|
||||
This image is used to create a distrobox container that seamlessly integrates with the rest of the
|
||||
operating system by providing access to the user's home directory,
|
||||
This image is used to create a container that seamlessly integrates with the rest of the operating system by providing access to the user's home directory,
|
||||
the Wayland and X11 sockets, networking, removable devices (like USB sticks), systemd journal, SSH agent, D-Bus,
|
||||
ulimits, /dev and the udev database, etc..
|
||||
|
||||
# Aims
|
||||
|
||||
This project aims to bring any distro userland to any other distro supporting podman.
|
||||
It has been written in posix sh to be as portable as possible and not have problems
|
||||
with glibc compatibility or versions.
|
||||
It has been written in posix sh to be as portable as possible and not have problems with glibc compatibility or versions.
|
||||
|
||||
It also aims to enter the container as fast as possible, every millisecond adds up if you use the it
|
||||
as your default environment for your terminal:
|
||||
@@ -63,8 +61,8 @@ real 0m0,281s
|
||||
user 0m0,116s
|
||||
sys 0m0,063s
|
||||
```
|
||||
It also includes a `distrobox-export` functionality to export applications and services from
|
||||
the container onto the host.
|
||||
|
||||
It is included also a `distrobox-export` functionality to export applications and services from the container onto the host.
|
||||
|
||||
# Compatibility
|
||||
|
||||
@@ -194,9 +192,18 @@ save them in your home to be used directly from the host as a normal app or `sys
|
||||
|
||||
# Installation
|
||||
|
||||
Clone the project using `git clone` or using the `download` button above to get the zip file.
|
||||
Enter the folder an copy the script files anywhere in your `$PATH`, remember to mark them as executable.
|
||||
If you like to live your life dangerously, you can trust me and simply run this in your terminal:
|
||||
|
||||
`curl https://raw.githubusercontent.com/89luca89/distrobox/main/install | sudo sh`
|
||||
|
||||
or if you want to select a custom folder to install without sudo:
|
||||
|
||||
`curl https://raw.githubusercontent.com/89luca89/distrobox/main/install | sh -s -- -p ~/.local/bin`
|
||||
|
||||
Else you can clone the project using `git clone` or using the `download zip` voice after clicking the green button above.
|
||||
|
||||
Enter the folder and run `./install`, by default it will attemp to install in `/usr/local/bin`, you can specify another folder if needed with `./install -p ~/.local/bin`
|
||||
|
||||
# Dependencies
|
||||
|
||||
It depends on `podman` configured in `rootless mode`
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ show_help() {
|
||||
|
||||
Arguments:
|
||||
--name/-n: name for the distrobox default: fedora-toolbox-35
|
||||
--: end arguments execute the rest as command to execute at login default: bash -l
|
||||
--/-e: end arguments execute the rest as command to execute at login default: bash -l
|
||||
--help/-h: show this message
|
||||
-v: show more verbosity
|
||||
"
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
#!/bin/sh
|
||||
# POSIX
|
||||
|
||||
dest_path="/usr/local/bin"
|
||||
verbose=0
|
||||
|
||||
# Print usage to stdout.
|
||||
# Arguments:
|
||||
# None
|
||||
# Outputs:
|
||||
# print usage with examples.
|
||||
show_help() {
|
||||
echo "USAGE:
|
||||
install -p /usr/local/bin
|
||||
|
||||
Arguments:
|
||||
--path/-p: path where to deploy the files (default /usr/local/bin)
|
||||
--help/-h: show this message
|
||||
-v: show more verbosity
|
||||
"
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
while :; do
|
||||
case $1 in
|
||||
-h | --help)
|
||||
# Call a "show_help" function to display a synopsis, then exit.
|
||||
show_help
|
||||
exit
|
||||
;;
|
||||
-v)
|
||||
shift
|
||||
verbose=1
|
||||
;;
|
||||
-p | --path)
|
||||
if [ -n "$2" ]; then
|
||||
dest_path="$2"
|
||||
shift
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
*) # Default case: If no more options then break out of the loop.
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set verbosity
|
||||
if [ "${verbose}" -ne 0 ]; then
|
||||
set -o xtrace
|
||||
fi
|
||||
|
||||
# Ensure the foundamental variables are set and not empty, we will not proceed if
|
||||
# they are not all set.
|
||||
[ ! -d "${dest_path}" ] && echo "Path ${dest_path} does not exist." && exit 1
|
||||
[ ! -w "${dest_path}" ] && echo "Cannot write into ${dest_path}, permission denied." && exit 1
|
||||
|
||||
# get current dir
|
||||
curr_dir=$(dirname "$0")
|
||||
cd "${curr_dir}" || exit 1
|
||||
|
||||
# if files are available, install files in dest folder
|
||||
# else download targz and uncompress it
|
||||
if [ -f "${curr_dir}/distrobox-enter" ]; then
|
||||
for file in distrobox-*; do
|
||||
cp "${file}" "${dest_path}"
|
||||
chmod 0755 "${dest_path}/${file}"
|
||||
done
|
||||
else
|
||||
|
||||
# check that we have base dependencies
|
||||
if ! command -v curl || ! command -v tar; then
|
||||
echo "Online install depends on curl and tar"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
release_ver=$(curl -L https://github.com/89luca89/distrobox/releases/latest | grep 'refs/tags' | tail -1 | cut -d'"' -f2)
|
||||
release_name=$(echo "${release_ver}" | rev | cut -d'/' -f1 | rev)
|
||||
|
||||
# go in tmp
|
||||
cd /tmp
|
||||
# download our target
|
||||
curl -L "https://github.com/${release_ver}" -o "${release_name}"
|
||||
# uncompress
|
||||
tar xvf "${release_name}"
|
||||
# deploy our files
|
||||
for file in "distrobox-$(echo "${release_name}" | sed 's/.tar.gz//g')"/distrobox-*; do
|
||||
cp "${file}" "${dest_path}"
|
||||
chmod 0755 "${dest_path}/${file}"
|
||||
done
|
||||
|
||||
# securely delete unneeded files
|
||||
rm -f "${release_name}"
|
||||
rm -f "distrobox-$(echo "${release_name}" | sed 's/.tar.gz//g')"/*
|
||||
rmdir "distrobox-$(echo "${release_name}" | sed 's/.tar.gz//g')"
|
||||
fi
|
||||
Reference in New Issue
Block a user