avoid direct comparisions to script_path
This commit is contained in:
parent
1338f4dc75
commit
99c1699ae6
29
install.sh
29
install.sh
|
@ -434,9 +434,6 @@ installer_main() {
|
||||||
trap installer_error_occurred ERR
|
trap installer_error_occurred ERR
|
||||||
trap installer_exit_cleanup EXIT
|
trap installer_exit_cleanup EXIT
|
||||||
|
|
||||||
log "Ensuring correct permissions ..."
|
|
||||||
chmod 0700 "${script_path}"
|
|
||||||
|
|
||||||
rm -rf /archroot/installer
|
rm -rf /archroot/installer
|
||||||
mkdir -p /archroot/installer
|
mkdir -p /archroot/installer
|
||||||
cd /archroot/installer
|
cd /archroot/installer
|
||||||
|
@ -457,6 +454,7 @@ installer_main() {
|
||||||
# prepare for transtiory_main
|
# prepare for transtiory_main
|
||||||
mv /sbin/init /sbin/init.original
|
mv /sbin/init /sbin/init.original
|
||||||
cp "${script_path}" /sbin/init
|
cp "${script_path}" /sbin/init
|
||||||
|
chmod 0755 /sbin/init
|
||||||
reboot
|
reboot
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -470,7 +468,7 @@ transitory_exit_occurred() {
|
||||||
transitory_main() {
|
transitory_main() {
|
||||||
|
|
||||||
trap transitory_exit_occurred EXIT
|
trap transitory_exit_occurred EXIT
|
||||||
if [ "${script_path}" = "/sbin/init" ]; then
|
if [ -e /etc/debian_version ]; then
|
||||||
# save script
|
# save script
|
||||||
mount -o remount,rw /
|
mount -o remount,rw /
|
||||||
cp "${script_path}" /archroot/installer/script.sh
|
cp "${script_path}" /archroot/installer/script.sh
|
||||||
|
@ -492,7 +490,7 @@ transitory_main() {
|
||||||
mount --bind / /archroot/realroot
|
mount --bind / /archroot/realroot
|
||||||
# chroot into archroot
|
# chroot into archroot
|
||||||
exec chroot /archroot /installer/script.sh
|
exec chroot /archroot /installer/script.sh
|
||||||
elif [ "${script_path}" = "/installer/script.sh" ]; then
|
elif [ -e /etc/arch-release ]; then
|
||||||
# now in archroot
|
# now in archroot
|
||||||
local oldroot=/realroot/archroot/oldroot
|
local oldroot=/realroot/archroot/oldroot
|
||||||
mkdir ${oldroot}
|
mkdir ${oldroot}
|
||||||
|
@ -562,13 +560,22 @@ canonicalize_path() {
|
||||||
|
|
||||||
script_path="$(canonicalize_path "${0}")"
|
script_path="$(canonicalize_path "${0}")"
|
||||||
if [ $$ -eq 1 ]; then
|
if [ $$ -eq 1 ]; then
|
||||||
transitory_main "$@"
|
transitory_main
|
||||||
elif [ "${script_path}" = "/sbin/init" ]; then
|
elif [ -e /etc/debian_version ]; then
|
||||||
exec /sbin/init.original "$@"
|
if [ "$(basename "${0}")" = "init" ]; then
|
||||||
elif [ "${script_path}" = "/installer/script.sh" ]; then
|
exec /sbin/init.original "$@"
|
||||||
finalize_main "$@"
|
else
|
||||||
|
installer_main
|
||||||
|
fi
|
||||||
|
elif [ -e /etc/arch-release ]; then
|
||||||
|
if [ -d /installer ]; then
|
||||||
|
finalize_main
|
||||||
|
else
|
||||||
|
install_compat_package
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
installer_main "$@"
|
log "Don't know what to do!"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue