align
dpkg_not_running
-vmware-detect
grml-runtty
-PROGS = vmware-detect dpkg_not_running grml-runtty
+PROGS = dpkg_not_running grml-runtty
#ifndef CFLAGS
CFLAGS = -O2 -Wall -s
all: $(PROGS)
-vmware-detect: vmware-detect.c
- diet $(CC) $(CFLAGS) -o $@ $^
-
dpkg_not_running: dpkg_not_running.c
diet $(CC) $(CFLAGS) -o $@ $^
+++ /dev/null
-/* Filename: vmware-detect.c
-* Purpose: Detect if running inside vmware
-* Authors: grml-team (grml.org), (c) Michael Gebetsroither <gebi@grml.org>
-* Bug-Reports: see http://grml.org/bugs/
-* License: This file is licensed under the GPL v2.
-*******************************************************************************/
-// return 0 if running inside vmware, 1 otherwise
-
-#include "string.h"
-#include "unistd.h"
-#include "stdio.h"
-#include "stdlib.h"
-#include "signal.h"
-
-#define WRITE(x) write(1, x, strlen(x))
-#define DWRITE(x) do{ \
- if(debug) { \
- WRITE(x); \
- } \
-} while(0);
-#define FALSE 0
-#define TRUE !FALSE
-
-/* doc:
- * vmware IO backdoor: http://chitchat.at.infoseek.co.jp/vmware/backdoor.html
- * http://www.honeynet.org/papers/bots/botnet-code.html
- * http://www.codegurus.be/codegurus/Programming/virtualpc&vmware_en.htm
- */
-
-// from libowfat {{{
-static inline char tohex(char c) {
- return c>=10?c-10+'a':c+'0';
-}
-
-unsigned int fmt_xlong(char *dest,unsigned long i) {
- register unsigned long len,tmp;
- /* first count the number of bytes needed */
- for (len=1, tmp=i; tmp>15; ++len) tmp>>=4;
- if (dest)
- for (tmp=i, dest+=len; ; ) {
- *--dest = tohex(tmp&15);
- if (!(tmp>>=4)) break;
- }
- return len;
-}
-// }}}
-
-void printIdtr(const unsigned char* idtr, unsigned size)
-{
- unsigned i;
- for(i=0; i<size; ++i) {
- char out[4] = {0};
- fmt_xlong(out, idtr[i]);
- if(strlen(out) == 1)
- WRITE("0");
- WRITE(out);
- }
- WRITE("\n");
-}
-
-// i386 and x86-64 {{{
-#if defined (__i386__) || defined (__x86_64__)
-int checkVmware(const int debug)
-{
- unsigned char idtr[10] = {0};
- asm("sidt %0" : "=m" (idtr));
- if(debug)
- printIdtr(idtr, sizeof(idtr));
- // should normally be the case on amd64, but does not work
- //return (0xff==idtr[9]) ? 1 : 0;
- return (0xff==idtr[5]) ? 1 : 0;
-}
-int checkVmwareIO()
-{
- unsigned int vmaj, vmin, magic, dout = 11;
- __asm__ __volatile__(
- "mov $0x564D5868, %%eax; /* magic number */"
- "mov $0x3c6cf712, %%ebx; /* random number */"
- "mov $0x0000000A, %%ecx; /* specifies command */"
- "mov $0x5658, %%edx; /* VMware I/O port */"
- "in %%dx, %%eax;"
- "mov %%eax, %0;"
- "mov %%ebx, %1;"
- "mov %%ecx, %2;"
- "mov %%edx, %3;"
- : "=r"(vmaj), "=r"(magic), "=r"(vmin), "=r"(dout));
-#ifdef DEBUG
- fprintf(stderr, "version: major=%x, minor=%x, magic=%x, dout=%x\n",
- vmaj, vmin, magic, dout);
-#endif
- return (0x564D5868 == magic) ? 1 : 0;
-}
-// }}}
-
-// others {{{
-#else
-// vmware runs only on the archs above
-int checkVmware(const int) { return 0; }
-int checkVmwareIO() { return 0; }
-#endif
-// }}}
-
-static int Killed = FALSE;
-
-// returns 0 if running inside vmware, 1 otherwise
-int main(int argc, char* argv[]) {
- int debug = FALSE;
- if(argc == 2 && !strcmp(argv[1], "--debug"))
- debug = TRUE;
-
- int a, b;
- // known to be false positives
- a = checkVmware(debug);
- DWRITE("idt-check: ")
- if(!a) {
- DWRITE("false\n");
- if(!debug)
- return EXIT_FAILURE;
- } else
- DWRITE("true\n");
-
- // never returns if not running under vmware
- void dummy() { Killed=TRUE; DWRITE("false\n"); exit(1); }
- signal(SIGSEGV, dummy);
- DWRITE("ioport-check: ");
- b = checkVmwareIO();
- if(b) {
- DWRITE("true\n");
- return EXIT_SUCCESS;
- } else {
- if(!Killed) {
- // check unusable or not implemented
- DWRITE("false\n");
- DWRITE("Check not implemented, yet!\n");
- return a ? EXIT_SUCCESS : EXIT_FAILURE;
- } else {
- // never reached
- WRITE("Error: IO check hasn't killed the program but no vmware found either!\n");
- return EXIT_FAILURE;
- }
- }
-}
-// vim: foldmethod=marker
+grml-scripts (2.13.0) unstable; urgency=medium
+
+ * [0c1cd5d] Drop broken and deprecated vmware-detect.
+ Thanks to AndrĂ¡s Korn
+
+ -- Michael Prokop <mika@grml.org> Wed, 06 Sep 2023 17:24:49 +0200
+
+grml-scripts (2.12.2) unstable; urgency=medium
+
+ [ Michael Schierl ]
+ * [099f921] Fix `grml2ram` when booted via `loopback.cfg`
+
+ -- Michael Prokop <mika@grml.org> Fri, 03 Feb 2023 17:26:26 +0100
+
+grml-scripts (2.12.1) unstable; urgency=medium
+
+ [ Darshaka Pathirana ]
+ * [b382566] grml-resolution: Quick 'n dirty xrandr output parser fix
+
+ -- Michael Prokop <mika@grml.org> Mon, 28 Nov 2022 08:35:17 +0100
+
+grml-scripts (2.12.0) unstable; urgency=medium
+
+ [ Darshaka Pathirana ]
+ * [570d959] Set SHELL variable in run-welcome + run-screen
+
+ -- Michael Prokop <mika@grml.org> Fri, 25 Nov 2022 09:50:44 +0100
+
+grml-scripts (2.11.2) unstable; urgency=medium
+
+ * [454a3e5] iimage: replace egrep usage with grep -E
+
+ -- Michael Prokop <mika@grml.org> Fri, 11 Nov 2022 17:01:40 +0100
+
+grml-scripts (2.11.1) unstable; urgency=medium
+
+ * [40ec66c] Drop debian/compat and switch to debhelper-compat approach
+ * [3b7f948] grml_chroot: fix broken mount argument handling
+
+ -- Michael Prokop <mika@grml.org> Tue, 07 Jun 2022 15:59:26 +0200
+
grml-scripts (2.11.0) unstable; urgency=medium
[ Darshaka Pathirana ]
grml-scripts: script-with-language-extension usr/bin/notifyd.py
-grml-scripts: statically-linked-binary usr/bin/vmware-detect
grml-scripts: statically-linked-binary usr/sbin/dpkg_not_running
cp -a usr_bin/* debian/grml-scripts/usr/bin/
cp -a usr_sbin/* debian/grml-scripts/usr/sbin/
cp -a usr_share/* debian/grml-scripts/usr/share/grml-scripts/
- install -m 755 compile/vmware-detect debian/grml-scripts/usr/bin/vmware-detect
install -m 755 compile/dpkg_not_running debian/grml-scripts/usr/sbin/dpkg_not_running
install -m 755 compile/grml-runtty debian/grml-scripts/sbin/grml-runtty
/usr/share/man/man1/grml-scripts.1.gz /usr/share/man/man1/pong.1.gz \
/usr/share/man/man1/grml-scripts.1.gz /usr/share/man/man1/soundtest.1.gz \
/usr/share/man/man1/grml-scripts.1.gz /usr/share/man/man1/unblacklist.1.gz \
- /usr/share/man/man1/grml-scripts.1.gz /usr/share/man/man1/vmware-detect.1.gz
+
dh_strip
dh_compress
mkdir -p $(CURDIR)/debian/grml-scripts/usr/share/lintian/overrides/
STRING=""
# current mode
-CURRENT_NUM=$(xrandr | awk '/\*/ {print $1}' | tr -d '*')
-CURRENT_RESOLUTION=$(xrandr | awk '/\*/ {print $2 $3 $4}')
+CURRENT_RESOLUTION=$(xrandr | awk '/\*/ {print $1"_"$2}')
# menu
-for i in $(xrandr | awk '{print $2$3$4}' | grep "^[0-9]") ; do
+for i in $(xrandr | awk '{print $1"_"$2}' | grep "^[0-9]") ; do
STRING="$STRING $COUNTER $i"
((COUNTER++))
done
CHOSE=$(cat "$RESOLUTION")
-if [ "$CHOSE" = "$CURRENT_NUM" ] ; then
- dialog --title "$PN" --msgbox "Chosen resolution corresponds to current resolution. No changes needed." 0 0
-elif [ -n "$CHOSE" ] ; then
+if [ -n "$CHOSE" ] ; then
# shellcheck disable=SC2015
xrandr -s "$CHOSE" 2>"$ERROR" && \
dialog --title "$PN" --msgbox "Running xrandr with resolution was succesful." 0 0 || \
find_all_images
for i in $ALL_IMAGES ; do
- if ! egrep "$i=" ./description >/dev/null ; then
+ if ! grep -E "$i=" ./description >/dev/null ; then
echo "$i=`description $i`" >> ./description
fi
GRMLSIZE="$(du $IMAGE | awk '{print $1}')"
RAM=$(/usr/bin/gawk '/MemFree/{print $2}' /proc/meminfo)
+LOOPDEV=$(/sbin/losetup -j "${IMAGE}" -n -O NAME)
case "$*" in -f|--force)
ewarn "Forcing copy process for grml-image (${GRMLSIZE}kB) as requested via force option." ; eend 0
einfo "Copying $IMAGE to RAM, this might take a while."
rsync -a --progress $IMAGE /tmp/GRML
LANGUAGE=C LANG=C LC_ALL=C perl << EOF
-open LOOP, '</dev/loop0' or die $!;
+open LOOP, '<${LOOPDEV}' or die $!;
open DEST, '</tmp/GRML' or die $!;
ioctl(LOOP, 0x4C06, fileno(DEST)) or die $!;
close LOOP;
# License: This file is licensed under the GPL v2.
################################################################################
+export SHELL=/bin/zsh
# try to mitigate raceconditions from screen
SCREENDIR_="/var/run/screen"
mkdir -m 700 "${SCREENDIR_}/S-$USER" >/dev/null 2>&1
# now run screen with config
if [ "$(id -u)" = 0 ] ; then
- exec screen -U -c /etc/grml/screenrc
+ exec screen -U -c /etc/grml/screenrc -s "-$SHELL"
elif [ -r "$HOME/.screenrc" ] ; then
- exec screen -U -c "$HOME/.screenrc"
+ exec screen -U -c "$HOME/.screenrc" -s "-$SHELL"
else
- exec screen -U -c /etc/grml/screenrc_generic
+ exec screen -U -c /etc/grml/screenrc_generic -s "-$SHELL"
fi
## END OF FILE #################################################################
# shellcheck disable=SC1091
. /etc/grml/sh-lib
+export SHELL=/bin/zsh
+
[ -r /etc/grml_version ] && GRMLVERSION=$(cat /etc/grml_version) || GRMLVERSION='(no version information available)'
PATH=$HOME/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/games:/home/grml/bin
CMDLINE=$(cat /proc/cmdline)
"
fi
-exec /bin/zsh -l
+exec "$SHELL" -l
## END OF FILE #################################################################