fix_path.sh 574 Bytes
Newer Older
Aaditya Bagga's avatar
Aaditya Bagga committed
1 2 3 4
#!/bin/sh
# fix_path.sh: fixes path in runscript and location of /var/run

DESTDIR=$1
5
SYSCONFDIR=${SYSCONFDIR:-etc}
Aaditya Bagga's avatar
Aaditya Bagga committed
6 7 8

_shebang='s|#!/sbin/runscript|#!/sbin/openrc-run|'
_runpath='s|/var/run|/run|g'
9 10
_sysconfdir="s|etc/conf.d|${SYSCONFDIR}/conf.d|g"
_sysinitdir="s|etc/init.d|${SYSCONFDIR}/init.d|g"
Aaditya Bagga's avatar
Aaditya Bagga committed
11

12
for file in ${DESTDIR}/${SYSCONFDIR}/init.d/*; do
13
  sed -e "${_shebang}" -e "${_runpath}" -e "${_sysconfdir}" -e "${_sysinitdir}" -i "$file"
Aaditya Bagga's avatar
Aaditya Bagga committed
14 15
done

16
for file in ${DESTDIR}/${SYSCONFDIR}/conf.d/*; do
17
  sed -e "${_runpath}" -e "${_sysconfdir}" -e "${_sysinitdir}" -i "$file"
Aaditya Bagga's avatar
Aaditya Bagga committed
18
done