History

Add global systemd var

Ypnose committed 12 years ago

Commit 1e28a7a1 parent df8e6631 file · +10 −5Browse files

Unified · Split

installer.sh.in+10−5
@@ -58,6 +58,11 @@ if [ -e /sys/firmware/efi/systab ]; then · 57 unmodified lines
5858 EFI_SYSTEM=1
5959 fi
6060
61+# Detect if systemd is installed
62+if [ "$(cat /proc/1/comm)" = "systemd" ]; then
63+ SYSTEMD_INIT=1
64+fi
65+
6166 # dialog colors
6267 BLACK="\Z0"
6368 RED="\Z1"
@@ -262,7 +267,7 @@ ${RESET}\n" 18 80 · 198 unmodified lines
262267 }
263268
264269 menu_keymap() {
265− if [ -x "/usr/bin/localectl" ]; then
270+ if [ "$SYSTEMD_INIT" -eq 1 ]; then
266271 local _keymaps="$(localectl --no-pager list-keymaps)"
267272 else
268273 local _keymaps="$(find /usr/share/kbd/keymaps/ -type f -iname "*.map.gz" -printf "%f\n" | sed 's|.map.gz||g' | sort)"
@@ -323,10 +328,10 @@ set_locale() { · 54 unmodified lines
323328 }
324329
325330 menu_timezone() {
326− if [ -x "/usr/bin/timedatectl" ]; then
331+ if [ "$SYSTEMD_INIT" -eq 1 ]; then
327332 local _tzones="$(timedatectl --no-pager list-timezones)"
328333 else
329− local _tzones="$(find /usr/share/zoneinfo Africa/ America/ Antarctica/ Arctic/ Asia/ Atlantic/ Australia/ Europe/ Indian/ Pacific/ -type f | sort)"
334+ local _tzones="$(cd /usr/share/zoneinfo; find Africa/ America/ Antarctica/ Arctic/ Asia/ Atlantic/ Australia/ Europe/ Indian/ Pacific/ -type f | sort)"
330335 fi
331336 local _TIMEZONES=
332337
@@ -778,7 +783,7 @@ install_packages() { · 445 unmodified lines
778783 }
779784
780785 enable_dhcpd() {
781− if [ -x "/usr/bin/systemctl" ]; then
786+ if [ "$SYSTEMD_INIT" -eq 1 ]; then
782787 chroot $TARGETDIR systemctl enable dhcpcd.service >$LOG 2>&1
783788 else
784789 ln -s /etc/sv/dhcpcd $TARGETDIR/etc/runit/runsvdir/default/dhcpcd
@@ -869,7 +874,7 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return · 84 unmodified lines
869874 elif [ "$_type" = "dhcp" ]; then
870875 if [ -f /etc/wpa_supplicant/wpa_supplicant-${_dev}.conf ]; then
871876 cp /etc/wpa_supplicant/wpa_supplicant-${_dev}.conf $TARGETDIR/etc/wpa_supplicant
872− if [ -x "/usr/bin/systemctl" ]; then
877+ if [ "$SYSTEMD_INIT" -eq 1 ]; then
873878 chroot $TARGETDIR systemctl enable dhcpcd@${_dev}.service >$LOG 2>&1
874879 else
875880 ln -s /etc/sv/dhcpcd-${_dev} $TARGETDIR/etc/runit/runsvdir/default/dhcpcd-${_dev}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t