Proposition for Add-on
Hi! I’ve d develop an internal command for grub to help the administrators of pool of dual boot machine. The problem: We have class with near 100 computers in dual boot, under windows we have a maintenance period in the night to automatically install update. For that, in grub we put Windows has the default menu-entry. The only time the computers are in linux, is when a student is using it. It's not a good time to install update. To install update, security patch, or other package, i was forced to pass computer by computer. To get a period for the maintenance in linux, i wrote a simple module for grub that select the default menu-entry depending of the time of the day. ex. : I set the period from 4am to 6am with the default boot to linux. So i can put a script in the crontab at 4h05 to install the update. (you have to put a shutdown -r command in Windows task scheduler at 4.00 am. And use a wake on lan for computer that are down) Is it possible to integrate in in the distribution of grub, if you think it could help other user. - The principal module grub-core/commands/select_by_time.c The configuration file, two option the simple version /etc/grub.d/98_select_by_time In 98_select_by_time, you select the period of time and the menuentry for that period, you can use many period of time. It use the 24 hours time format notation without colon. ex: # from 4 am to 6 am select item 3 as default select_by_time 0400 0600 3 # and from 11h25 pm to midnight select item 5 as default select_by_time 2325 2400 5 or the more complete /etc/grub.d/99_select_by_time, that use the config file /boot/grub/select_by_time.cfg With this version you don't have to know the position of the operating system in grub.cfg (menuitem). exemple of select_by_time.cfg select_default Windows select_by_time 5:00 6:00 ubuntu # maintenance period select_by_time 13:00 15:00 ubuntu # linux course select_by_time 19:00 2308 "Linux 3.2.0-23-generic"# specific –-- Right now, we are using select_by_time with 98_select_by_time, and we save a lot of days of work. If you think it could be helpful for other administrator, could you put it in a future grub distribution (the source code is very simple). The 99_select_by_time is optional, it's just more easy to use. Thank's -- Michel Benoit (morph1853) Technicien Systèmes Ordinés Dep. Informatique Université de Sherbooke michel.ben...@usherbrooke.ca 98_select_by_time Description: Binary data 99_select_by_time Description: Binary data select_by_time.c Description: Binary data select_by_time.cfg Description: Binary data ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: Proposition for Add-on
The way things like this are usually done on mailing lists like this one are that you post a patch file containing the changes that you have made to the entire project, not simply the source file you want included. There are special commands for this, which you can find on the Internet. You also typically put the patch in the body of your message without formatting. One of the head people on the project will then review it and see if it's worth including. I'm new here myself, but it's important to learn the proper way to do things. -- SevenBits On Sunday, December 1, 2013, Michel Benoit wrote: > Hi! > > I’ve d develop an internal command for grub to help the administrators of > pool of dual boot machine. > > The problem: We have class with near 100 computers in dual boot, under > windows we have a maintenance period in the night to automatically install > update. For that, in grub we put Windows has the default menu-entry. > > The only time the computers are in linux, is when a student is using it. > It's not a good time to install update. To install update, security patch, > or other package, i was forced to pass computer by computer. > > > To get a period for the maintenance in linux, i wrote a simple module for > grub that select the default menu-entry depending of the time of the day. > > ex. : > >I set the period from 4am to 6am with the default boot to linux. >So i can put a script in the crontab at 4h05 to install the update. >(you have to put a shutdown -r command in Windows task scheduler at > 4.00 am. And use a wake on lan for computer that are down) > > Is it possible to integrate in in the distribution of grub, if you think > it could help other user. > > > > - > > The principal module grub-core/commands/select_by_time.c > > The configuration file, two option > >the simple version /etc/grub.d/98_select_by_time > >In 98_select_by_time, you select the period of time and > the menuentry for that period, you can use many period of time. It use the > 24 hours time format notation without colon. > >ex: > ># from 4 am to 6 am select item 3 as default >select_by_time 0400 0600 3 ># and from 11h25 pm to midnight select item 5 as default >select_by_time 2325 2400 5 > > or > >the more complete /etc/grub.d/99_select_by_time, that use the > config file /boot/grub/select_by_time.cfg >With this version you don't have to know the position of the > operating system in grub.cfg (menuitem). > >exemple of select_by_time.cfg > >select_default Windows >select_by_time 5:00 6:00 ubuntu # maintenance period >select_by_time 13:00 15:00 ubuntu # linux course >select_by_time 19:00 2308 "Linux 3.2.0-23-generic"# specific > > –--- > --- > > Right now, we are using select_by_time with 98_select_by_time, and we save > a lot of days of work. > If you think it could be helpful for other administrator, could you put it > in a future grub distribution (the source code is very simple). > The 99_select_by_time is optional, it's just more easy to use. > > Thank's > > -- > Michel Benoit (morph1853) > Technicien Systèmes Ordinés > Dep. Informatique > Université de Sherbooke > michel.ben...@usherbrooke.ca > ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: Proposition for Add-on
On 02.12.2013 01:11, Michel Benoit wrote: > Hi! > > I’ve d develop an internal command for grub to help the administrators > of pool of dual boot machine. > > The problem: We have class with near 100 computers in dual boot, under > windows we have a maintenance period in the night to automatically > install update. For that, in grub we put Windows has the default > menu-entry. > > The only time the computers are in linux, is when a student is using it. > It's not a good time to install update. To install update, security > patch, or other package, i was forced to pass computer by computer. > No neede to write a module for this. Just do: insmod datehook if [ $HOUR -ge 4 -a $HOUR -lt 6 ]; then default=linux else default=windows fi > > To get a period for the maintenance in linux, i wrote a simple module > for grub that select the default menu-entry depending of the time of the > day. > > ex. : > >I set the period from 4am to 6am with the default boot to linux. >So i can put a script in the crontab at 4h05 to install the update. >(you have to put a shutdown -r command in Windows task scheduler at > 4.00 am. And use a wake on lan for computer that are down) > > Is it possible to integrate in in the distribution of grub, if you think > it could help other user. > > - > > > The principal module grub-core/commands/select_by_time.c > > The configuration file, two option > >the simple version /etc/grub.d/98_select_by_time > >In 98_select_by_time, you select the period of time > and the menuentry for that period, you can use many period of time. It > use the 24 hours time format notation without colon. > >ex: > ># from 4 am to 6 am select item 3 as default >select_by_time 0400 0600 3 ># and from 11h25 pm to midnight select item 5 as default >select_by_time 2325 2400 5 > > or > >the more complete /etc/grub.d/99_select_by_time, that use the > config file /boot/grub/select_by_time.cfg >With this version you don't have to know the position of the > operating system in grub.cfg (menuitem). > >exemple of select_by_time.cfg > >select_default Windows >select_by_time 5:00 6:00 ubuntu # maintenance period >select_by_time 13:00 15:00 ubuntu # linux course >select_by_time 19:00 2308 "Linux 3.2.0-23-generic"# specific > > –-- > > > Right now, we are using select_by_time with 98_select_by_time, and we > save a lot of days of work. > If you think it could be helpful for other administrator, could you put > it in a future grub distribution (the source code is very simple). > The 99_select_by_time is optional, it's just more easy to use. > > Thank's > > -- > Michel Benoit (morph1853) > Technicien Systèmes Ordinés > Dep. Informatique > Université de Sherbooke > michel.ben...@usherbrooke.ca > > > ___ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel > signature.asc Description: OpenPGP digital signature ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH] add grub_qsort_strcmp to use when sorting array of strings
On 30.11.2013 11:59, Andrey Borzenkov wrote: > В Sat, 30 Nov 2013 11:39:12 +0100 > Vladimir 'φ-coder/phcoder' Serbinenko пишет: > >> On 29.11.2013 18:01, Andrey Borzenkov wrote: >>> Compare function used in qsort gets arguments by reference, so strcmp >>> cannot be used directly - it expects pointer to char, but gets pointer >>> to pointer to char. >>> >>> Introduce new helper grub_qsort_strcmp and use it in grub-install. >>> This helper is going to be used in a couple more places as well so >>> add it to global file, not in grub-install.c. >>> >> Nice catch. But I don't we have enough use for grub_qsort_strcmp to make >> it global. Can you make it static in grub-install.c ? > > I have pending patches to sort long lists in help output of commands > (grub-mkimage and grub-probe target lists). They are long enough to > wish some ordering. > Ok, then go ahead. > > > ___ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel > signature.asc Description: OpenPGP digital signature ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH] Fix grub-shell to avoid breaking "make distcheck"
On 29.11.2013 15:12, Colin Watson wrote: > Copying the themes directory in grub-shell isn't > parallel-test-friendly and breaks on the second test when the source > directory is read-only (as in "make distcheck"). Instead, add a > --themes-directory option to grub-mkrescue et al, and use it in > grub-shell. I agree with the patch but I'm unsure whether --themes-idrectory has to be a hidden option or appear in --help. > --- > ChangeLog | 8 > include/grub/util/install.h | 4 > tests/util/grub-shell.in| 5 +++-- > util/grub-install-common.c | 20 ++-- > 4 files changed, 33 insertions(+), 4 deletions(-) > > diff --git a/ChangeLog b/ChangeLog > index ad83563..7b55a7a 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,5 +1,13 @@ > 2013-11-29 Colin Watson > > + Copying the themes directory in grub-shell isn't > + parallel-test-friendly and breaks on the second test when the source > + directory is read-only (as in "make distcheck"). Instead, add a > + --themes-directory option to grub-mkrescue et al, and use it in > + grub-shell. > + > +2013-11-29 Colin Watson > + > * docs/grub-dev.texi (Font Metrics): Exclude @image command from DVI > builds, since we don't have an EPS version of font_char_metrics.png. > Add leading dot to image extension per the Texinfo documentation. > diff --git a/include/grub/util/install.h b/include/grub/util/install.h > index 5cb33fc..891d170 100644 > --- a/include/grub/util/install.h > +++ b/include/grub/util/install.h > @@ -50,6 +50,9 @@ >{ "locale-directory", GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY, > \ >N_("DIR"), 0, \ > N_("use translations under DIR [default=%s]"), 1 }, > \ > + { "themes-directory", GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY, > \ > + N_("DIR"), 0, \ > +N_("use themes under DIR [default=%s]"), 1 },\ >{ "grub-mkimage", GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE, \ >"FILE", OPTION_HIDDEN, 0, 1 }, \ > /* TRANSLATORS: "embed" is a verb (command description). "*/\ > @@ -106,6 +109,7 @@ enum grub_install_options { >GRUB_INSTALL_OPTIONS_INSTALL_COMPRESS, >GRUB_INSTALL_OPTIONS_DIRECTORY2, >GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY, > + GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY, >GRUB_INSTALL_OPTIONS_GRUB_MKIMAGE > }; > > diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in > index 5f20b64..d9a5253 100644 > --- a/tests/util/grub-shell.in > +++ b/tests/util/grub-shell.in > @@ -347,9 +347,10 @@ if test -z "$debug"; then > fi > > if [ x$boot != xnet ] && [ x$boot != xemu ]; then > -cp -R "@srcdir@/themes" "@builddir@" > pkgdatadir="@builddir@" "@builddir@/grub-mkrescue" "--output=${isofile}" > "--override-directory=${builddir}/grub-core" \ > - --rom-directory="${rom_directory}" $mkimage_extra_arg ${mkrescue_args} \ > + --rom-directory="${rom_directory}" \ > + --themes-directory="@srcdir@/themes" \ > + $mkimage_extra_arg ${mkrescue_args} \ > "/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \ > ${files} >/dev/null 2>&1 > fi > diff --git a/util/grub-install-common.c b/util/grub-install-common.c > index 91b558e..3204bc4 100644 > --- a/util/grub-install-common.c > +++ b/util/grub-install-common.c > @@ -60,6 +60,8 @@ grub_install_help_filter (int key, const char *text, >return xasprintf(text, grub_util_get_pkglibdir ()); > case GRUB_INSTALL_OPTIONS_LOCALE_DIRECTORY: >return xasprintf(text, grub_util_get_localedir ()); > +case GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY: > + return grub_util_path_concat (2, grub_util_get_pkgdatadir (), > "themes"); > default: >return (char *) text; > } > @@ -220,6 +222,7 @@ struct install_list install_fonts = { 1, 0, 0, 0 }; > struct install_list install_themes = { 1, 0, 0, 0 }; > char *grub_install_source_directory = NULL; > char *grub_install_locale_directory = NULL; > +char *grub_install_themes_directory = NULL; > > void > grub_install_push_module (const char *val) > @@ -320,6 +323,10 @@ grub_install_parse (int key, char *arg) >free (grub_install_locale_directory); >grub_install_locale_directory = xstrdup (arg); >return 1; > +case GRUB_INSTALL_OPTIONS_THEMES_DIRECTORY: > + free (grub_install_themes_directory); > + grub_install_themes_directory = xstrdup (arg); > + return 1; > case GRUB_INSTALL_OPTIONS_INSTALL_MODULES: >handle_install_list (&install_modules, arg, 0); >return 1; > @@ -666,6 +673,7 @@ grub_install_copy_files (const char *src, > { >char *dst_platform, *dst_locale, *dst_fonts; >const char *pkgdatadir = grub_util_get_pkgdatadir (); > + char *themes_dir; > >{ > char
Re: [PATCH] fix use of grub-probe instead of ${grub_probe}
Go ahead. On 29.11.2013 09:18, Andrey Borzenkov wrote: > --- > util/grub.d/30_os-prober.in | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in > index 3d1b938..0470e66 100644 > --- a/util/grub.d/30_os-prober.in > +++ b/util/grub.d/30_os-prober.in > @@ -112,7 +112,7 @@ for OS in ${OSPROBED} ; do >LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`" >LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`" >BOOT="`echo ${OS} | cut -d ':' -f 4`" > - UUID="`grub-probe --target=fs_uuid --device ${DEVICE%@*}`" > + UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`" >EXPUUID="$UUID" > >if [ x"${DEVICE#*@}" != x ] ; then > signature.asc Description: OpenPGP digital signature ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel