--- cfg-update-1.8.2-r1/cfg-update +++ cfg-update-1.8.2-r1/cfg-update @@ -538,9 +538,9 @@ local $ENV{LC_ALL}="C"; if (`grep '^.*cfg-update.*--index' $portage_hook` =~ /cfg-update/) { local $ENV{LC_ALL}="C"; - if (`grep '^#.*cfg-update.*--index' $portage_hook` =~ /cfg-update/) { + if (`grep ': cfg-update.*--index' $portage_hook` =~ /cfg-update/) { &root_only("Can't enable the Portage hook if you're not root..."); - `perl -p -i -e 's/#if \\[ \\"\\\$EBUILD_PHASE\\" = \\"setup\\" \\] && \\[ -e \\"\\/usr\\/bin\\/cfg-update\\" \\]; then cfg-update --index; fi/if \\[ \\"\\\$EBUILD_PHASE\\" = \\"setup\\" \\] && \\[ -e \\"\\/usr\\/bin\\/cfg-update\\" \\]; then cfg-update --index; fi/;' $portage_hook`; + `perl -p -i -e 's/: (cfg-update.*--index)/\$1/;' $portage_hook`; if ($opt_d >= 1) { print "$tab"."Enabled Portage hook in $portage_hook...\n"; } } else { if ($opt_d >= 1) { print "$tab"."Portage hook is already enabled...\n"; } @@ -549,16 +549,17 @@ &root_only("Can't add the Portage hook if you're not root..."); `echo >> $portage_hook`; `echo "# This hook is neccesary for automatic updating of the cfg-update index, please do not modify it!" >> $portage_hook`; - `echo "if [ \\"\\\$EBUILD_PHASE\\" = \\"setup\\" ] && [ -e \\"/usr/bin/cfg-update\\" ]; then cfg-update --index; fi" >> $portage_hook`; - `echo >> $portage_hook`; + `echo "pre_pkg_setup() {" >> $portage_hook`; + `echo " [[ \\\$ROOT = / ]] && cfg-update --index" >> $portage_hook`; + `echo "}" >> $portage_hook`; if ($opt_d >= 1) { print "$tab"."Added Portage hook in $portage_hook...\n"; } } } else { &root_only("Can't create the Portage hook if you're not root..."); - `echo >> $portage_hook`; `echo "# This hook is neccesary for automatic updating of the cfg-update index, please do not modify it!" >> $portage_hook`; - `echo "if [ \\"\\\$EBUILD_PHASE\\" = \\"setup\\" ] && [ -e \\"/usr/bin/cfg-update\\" ]; then cfg-update --index; fi" >> $portage_hook`; - `echo >> $portage_hook`; + `echo "pre_pkg_setup() {" >> $portage_hook`; + `echo " [[ \\\$ROOT = / ]] && cfg-update --index" >> $portage_hook`; + `echo "}" >> $portage_hook`; if ($opt_d >= 1) { print "$tab"."Created Portage hook in $portage_hook...\n"; } } } @@ -2209,11 +2210,11 @@ local $ENV{LC_ALL}="C"; if (`grep '^.*cfg-update.*--index' $portage_hook` =~ /cfg-update/) { local $ENV{LC_ALL}="C"; - if (`grep '^#.*cfg-update.*--index' $portage_hook` =~ /cfg-update/) { + if (`grep ': cfg-update.*--index' $portage_hook` =~ /cfg-update/) { if ($opt_ebuild == 0) { print "$tab"." Portage hook is already disabled...\n"; } } else { &root_only("Can't disable the Portage hook if you're not root..."); - `perl -p -i -e 's/^if \\[ \\"\\\$EBUILD_PHASE\\" = \\"setup\\" \\] && \\[ -e \\"\\/usr\\/bin\\/cfg-update\\" \\]; then cfg-update --index; fi/#if \\[ \\"\\\$EBUILD_PHASE\\" = \\"setup\\" \\] && \\[ -e \\"\\/usr\\/bin\\/cfg-update\\" \\]; then cfg-update --index; fi/;' $portage_hook`; + `perl -p -i -e 's/cfg-update.*--index/: \$&/;' $portage_hook`; if ($opt_ebuild == 0) { print "$tab"." Disabled Portage hook in $portage_hook...\n"; } } } else {