16881f68fSopenharmony_ci#!/bin/sh
26881f68fSopenharmony_ci#
36881f68fSopenharmony_ci# Don't call this script. It is used internally by the Meson
46881f68fSopenharmony_ci# build system. Thank you for your cooperation.
56881f68fSopenharmony_ci#
66881f68fSopenharmony_ci
76881f68fSopenharmony_ciset -e
86881f68fSopenharmony_ci
96881f68fSopenharmony_cisysconfdir="$1"
106881f68fSopenharmony_cibindir="$2"
116881f68fSopenharmony_ciudevrulesdir="$3"
126881f68fSopenharmony_ciuseroot="$4"
136881f68fSopenharmony_ciinitscriptdir="$5"
146881f68fSopenharmony_ci
156881f68fSopenharmony_ci# Both sysconfdir and bindir are absolute paths (since they are joined
166881f68fSopenharmony_ci# with --prefix in meson.build), but need to be interpreted relative
176881f68fSopenharmony_ci# to DESTDIR (if specified).
186881f68fSopenharmony_ci
196881f68fSopenharmony_ciif [ -z "${DESTDIR}" ]; then
206881f68fSopenharmony_ci    # Prevent warnings about uninitialized variable
216881f68fSopenharmony_ci    DESTDIR=""
226881f68fSopenharmony_cielse
236881f68fSopenharmony_ci    # Get rid of duplicate slash
246881f68fSopenharmony_ci    DESTDIR="${DESTDIR%/}"
256881f68fSopenharmony_cifi
266881f68fSopenharmony_ci
276881f68fSopenharmony_ciinstall -D -m 644 "${MESON_SOURCE_ROOT}/util/fuse.conf" \
286881f68fSopenharmony_ci	"${DESTDIR}${sysconfdir}/fuse.conf"
296881f68fSopenharmony_ci
306881f68fSopenharmony_ciif $useroot; then
316881f68fSopenharmony_ci    chown root:root "${DESTDIR}${bindir}/fusermount3"
326881f68fSopenharmony_ci    chmod u+s "${DESTDIR}${bindir}/fusermount3"
336881f68fSopenharmony_ci
346881f68fSopenharmony_ci    if test ! -e "${DESTDIR}/dev/fuse"; then
356881f68fSopenharmony_ci        mkdir -p "${DESTDIR}/dev"
366881f68fSopenharmony_ci        mknod "${DESTDIR}/dev/fuse" -m 0666 c 10 229
376881f68fSopenharmony_ci    fi
386881f68fSopenharmony_cifi
396881f68fSopenharmony_ci
406881f68fSopenharmony_ciif [ "${udevrulesdir}" != "" ]; then
416881f68fSopenharmony_ci    install -D -m 644 "${MESON_SOURCE_ROOT}/util/udev.rules" \
426881f68fSopenharmony_ci        "${DESTDIR}${udevrulesdir}/99-fuse3.rules"
436881f68fSopenharmony_cifi
446881f68fSopenharmony_ci
456881f68fSopenharmony_ciif [ "$initscriptdir" != "" ]; then
466881f68fSopenharmony_ci    install -D -m 755 "${MESON_SOURCE_ROOT}/util/init_script" \
476881f68fSopenharmony_ci            "${DESTDIR}${initscriptdir}/fuse3"
486881f68fSopenharmony_ci
496881f68fSopenharmony_ci    if test -x /usr/sbin/update-rc.d && test -z "${DESTDIR}"; then
506881f68fSopenharmony_ci        /usr/sbin/update-rc.d fuse3 start 34 S . start 41 0 6 . || /bin/true
516881f68fSopenharmony_ci    else
526881f68fSopenharmony_ci        echo "== FURTHER ACTION REQUIRED =="
536881f68fSopenharmony_ci        echo "Make sure that your init system will start the ${DESTDIR}${initscriptdir}/init.d/fuse3 init script"
546881f68fSopenharmony_ci    fi
556881f68fSopenharmony_cifi
56