mirror of
https://github.com/RasppleII/a2server.git
synced 2025-01-04 23:30:06 +00:00
8897610d95
One of the reasons I held off on doing this before is that there are a lot of complex one-line seds in here that I expect _will_ be broken by this. More than a few of these will assume, depend on, require, and break if specific hardcoded whitespace is not found. That's problematic anyway--when whitespace isn't syntactic, you shouldn't do that. So it's time to fix these anyway.
28 lines
1.2 KiB
Bash
Executable File
28 lines
1.2 KiB
Bash
Executable File
#! /bin/bash
|
|
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
|
|
|
|
# This script helps when running on the Linux console within a VirtualBox VM.
|
|
|
|
echo
|
|
|
|
userPw=$(sudo grep "^$USER" /etc/shadow | cut -f 2 -d ':')
|
|
[[ $userPw == "$(echo 'apple2' | perl -e '$_ = <STDIN>; chomp; print crypt($_, $ARGV[0])' "${userPw%"${userPw#\$*\$*\$}"}")" ]] && isApple2Pw=1 || isApple2Pw=
|
|
[[ $userPw == "$(echo 'raspberry' | perl -e '$_ = <STDIN>; chomp; print crypt($_, $ARGV[0])' "${userPw%"${userPw#\$*\$*\$}"}")" ]] && isRaspberryPw=1 || isRaspberryPw=
|
|
|
|
password="your password"
|
|
[[ $isApple2Pw ]] && password="'apple2'"
|
|
[[ $isRaspberryPw ]] && password="'raspberry'"
|
|
|
|
isDebian=
|
|
b_release -a 2> /dev/null | grep -q 'Distributor ID:.Debian' && [[ ( -f /etc/debian_version ) && ( $(cut -d . -f 1 < /etc/debian_version) -ge "7" ) ]] && isDebian=1
|
|
|
|
if [[ $isDebian ]]; then
|
|
if { lspci 2> /dev/null | grep -q VirtualBox; }; then
|
|
echo "A2SERVER: Disabling VirtualBox console screen blanking..."
|
|
sudo sed -i 's/^BLANK_DPMS=off/BLANK_DPMS=on/' /etc/kbd/config
|
|
sudo sed -i 's/^BLANK_TIME=[^0].$/BLANK_TIME=0/' /etc/kbd/config
|
|
sudo /etc/init.d/kbd restart &> /dev/null
|
|
sudo /etc/init.d/console-setup restart &> /dev/null
|
|
fi
|
|
fi
|