Initial commit

This commit is contained in:
sisungo committed 2026-10-31 12:50:20 +08:00
commit 2212875018
9 files changed
+154

No files matched your search

+69
View File
@@ -0,0 +1,69 @@
#!/bin/sh
PREFIX="$(dirname $(realpath $0))/.."
source "${PREFIX}/share/config.sh"
usage() {
echo "usage: airup-mount [-t type] [-o options] [-n name] [-d dependencies] [from] [to]"
echo
echo "Create Airup service that mounts given filesystem."
echo
echo "options:"
echo " -t limit the set of filesystem types"
echo " -o comma-separated list of mount options"
echo " -n name of the mount service"
echo " -d dependencies of the mount service"
exit 1
}
deps_to_array() {
[ -z "$1" ] && { printf '[]'; return; }
printf '%s' "$1" \
| sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' \
-e 's/[[:space:]]*,[[:space:]]*/", "/g' \
-e 's/^/["/' -e 's/$/"]/'
}
generate() {
echo "[service]"
echo "display-name = \"Filesystem ${dst}\""
echo "description = \"This service mounts from ${src} to ${dst}.\""
echo "kind = \"oneshot\""
echo "dependencies = $(deps_to_array ${dependencies})"
echo
echo "[exec]"
echo "start = \"mount -o '${options}' -t '${type}' '${src}' '${dst}'\""
echo "stop = \"umount '${dst}'\""
}
type="auto"
options="defaults"
while getopts ":t:o:d:n:rh" opt; do
case "$opt" in
t) type="$OPTARG" ;;
o) options="$OPTARG" ;;
d) dependencies="$OPTARG" ;;
n) name="$OPTARG" ;;
r) raw=1 ;;
:) usage ;;
\?) usage ;;
h) usage ;;
*) usage ;;
esac
done
shift $((OPTIND - 1))
src="$1"
dst="$2"
[ -z "$name" ] && name=mount-$(echo "${dst#/}" | tr "/" "-")
if [ "$raw" = "1" ]; then
generate
else
mkdir -p "${SERVICEDIR}" || exit 1
generate >> "${SERVICEDIR}/${name}.airs"
fi
+17
View File
@@ -0,0 +1,17 @@
#!/bin/sh
usage() {
echo "usage: airup-select-default-milestone [NAME]"
exit 1
}
if [ "$1" = "--help" ] || [ "$1" = "-h" ] || [ -z "$1" ]; then
usage
fi
if [ -e "/share/milestones/$1.airm" ]; then
ln -sf "/share/milestones/$1.airm" "/share/milestones/default.airm"
else
echo "error: milestone '$1' not found"
exit 1
fi
Executable
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
cd $(dirname $0)
if [ -z "${PREFIX}" ]; then
echo "install.sh: Requires \$PREFIX." >&2
exit 1
fi
# Clean up target directory
rm -rf ./target
mkdir -p ./target
# Install tools
cp -a ./bin ./target/bin
# Install data
cp -a ./share ./target/share
sed -i "s|\$PREFIX|$PREFIX|g" $(find ./target/share/milestones -type f)
+2
View File
@@ -0,0 +1,2 @@
SERVICEDIR="/share/services"
MILESTONEDIR="/share/milestones"
@@ -0,0 +1,17 @@
run $PREFIX/mount-basic-filesystems.sh
# Start `lxdeviced`.
start lxdeviced
run console.info "Probing connected hardware devices..."
run device trigger --action=add
run device wait-for-idle
# Start `accountd`.
#
# Running services as an user other than root depends on this, so it is run early.
start accountd
# Run the logger.
#
# Ensuring the logger to run before other services can help us capture more system logs during system boot.
start airup-fallback-logger
@@ -0,0 +1,5 @@
[milestone]
display-name = "Basic Services"
description = "The milestone that is depended by almost all boot milestones, and includes basic system services."
dependencies = []
kind = "serial"
@@ -0,0 +1,5 @@
[milestone]
display-name = "Normal Boot"
description = "The milestone that is usually entered on a normal system boot."
dependencies = ["basic-services"]
kind = "async"
@@ -0,0 +1,5 @@
[milestone]
display-name = "System Reboot"
description = "The milestone that is entered on system reboot."
dependencies = []
kind = "serial"
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
mount -o remount,rw /
umount -q /dev /sys /proc /run
mount -t tmpfs run /run
mount -t sysfs sys /sys
mount -t proc proc /proc
if grep -q devtmpfs /proc/filesystems; then
mount -t devtmpfs dev /dev
else
mount -t tmpfs dev /dev
fi