Teach sysinstall to recognize if acpi was turned off from the bootloader,
and then ask the user if this should be made permanent. Approved by: re
This commit is contained in:
parent
049e6a81c8
commit
f2f79e8c3f
@ -45,6 +45,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/mount.h>
|
||||
#include <time.h>
|
||||
#include <kenv.h>
|
||||
|
||||
static Chunk *chunk_list[MAX_CHUNKS];
|
||||
static int nchunks;
|
||||
@ -1053,3 +1054,40 @@ configEtcTtys(dialogMenuItem *self)
|
||||
restorescr(w);
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
int
|
||||
checkLoaderACPI(void)
|
||||
{
|
||||
char val[4];
|
||||
|
||||
if (kenv(KENV_GET, "loader.acpi_disabled_by_user", &val[0], 4) <= 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (strtol(&val[0], NULL, 10) <= 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
configLoaderACPI(int disable)
|
||||
{
|
||||
FILE *ldconf;
|
||||
|
||||
ldconf = fopen("/boot/loader.conf", "a");
|
||||
if (ldconf == NULL) {
|
||||
msgConfirm("Unable to open /boot/loader.conf. Please consult the\n"
|
||||
"FreeBSD Handbook for instructions on disabling ACPI");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
|
||||
fprintf(ldconf, "# --- Generated by sysinstall ---\n");
|
||||
fprintf(ldconf, "hint.acpi.0.disabled=%d\n", disable);
|
||||
fclose(ldconf);
|
||||
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
@ -666,6 +666,15 @@ installStandard(dialogMenuItem *self)
|
||||
dmenuOpenSimple(&MenuMouse, FALSE);
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
if (checkLoaderACPI() != 0) {
|
||||
dialog_clear_norefresh();
|
||||
if (!msgNoYes("ACPI was disabled during boot.\n"
|
||||
"Would you like to disable it permanently?"))
|
||||
(void)configLoaderACPI(1 /*disable*/);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now would be a good time to checkpoint the configuration data */
|
||||
configRC_conf();
|
||||
sync();
|
||||
|
@ -532,6 +532,10 @@ extern int configSecurityProfile(dialogMenuItem *self);
|
||||
extern int configSecurityExtreme(dialogMenuItem *self);
|
||||
extern int configSecurityModerate(dialogMenuItem *self);
|
||||
extern int configEtcTtys(dialogMenuItem *self);
|
||||
#ifdef __i386__
|
||||
extern int checkLoaderACPI(void);
|
||||
extern int configLoaderACPI(int);
|
||||
#endif
|
||||
|
||||
/* devices.c */
|
||||
extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d),
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/mount.h>
|
||||
#include <time.h>
|
||||
#include <kenv.h>
|
||||
|
||||
static Chunk *chunk_list[MAX_CHUNKS];
|
||||
static int nchunks;
|
||||
@ -1053,3 +1054,40 @@ configEtcTtys(dialogMenuItem *self)
|
||||
restorescr(w);
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
int
|
||||
checkLoaderACPI(void)
|
||||
{
|
||||
char val[4];
|
||||
|
||||
if (kenv(KENV_GET, "loader.acpi_disabled_by_user", &val[0], 4) <= 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (strtol(&val[0], NULL, 10) <= 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
int
|
||||
configLoaderACPI(int disable)
|
||||
{
|
||||
FILE *ldconf;
|
||||
|
||||
ldconf = fopen("/boot/loader.conf", "a");
|
||||
if (ldconf == NULL) {
|
||||
msgConfirm("Unable to open /boot/loader.conf. Please consult the\n"
|
||||
"FreeBSD Handbook for instructions on disabling ACPI");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
|
||||
fprintf(ldconf, "# --- Generated by sysinstall ---\n");
|
||||
fprintf(ldconf, "hint.acpi.0.disabled=%d\n", disable);
|
||||
fclose(ldconf);
|
||||
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
@ -666,6 +666,15 @@ installStandard(dialogMenuItem *self)
|
||||
dmenuOpenSimple(&MenuMouse, FALSE);
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
if (checkLoaderACPI() != 0) {
|
||||
dialog_clear_norefresh();
|
||||
if (!msgNoYes("ACPI was disabled during boot.\n"
|
||||
"Would you like to disable it permanently?"))
|
||||
(void)configLoaderACPI(1 /*disable*/);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now would be a good time to checkpoint the configuration data */
|
||||
configRC_conf();
|
||||
sync();
|
||||
|
@ -532,6 +532,10 @@ extern int configSecurityProfile(dialogMenuItem *self);
|
||||
extern int configSecurityExtreme(dialogMenuItem *self);
|
||||
extern int configSecurityModerate(dialogMenuItem *self);
|
||||
extern int configEtcTtys(dialogMenuItem *self);
|
||||
#ifdef __i386__
|
||||
extern int checkLoaderACPI(void);
|
||||
extern int configLoaderACPI(int);
|
||||
#endif
|
||||
|
||||
/* devices.c */
|
||||
extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d),
|
||||
|
Loading…
Reference in New Issue
Block a user