I have a little script. It's ripped out of a Youtube tutorial, untested, ugly, and not very good. It's not done and not intended for public use. Here it is:
#!/bin/bash
sudo apt-get -y install git g++ gcc-multilib g++-multilib libc6-dev-i386 lib32z1-dev lib32bz2-dev xserver-xorg-dev:i386 libfreetype6-dev:i386 libmirclient-dev:i386 libosmesa6:i386 libosmesa-dev libjpeg-turbo8-dev:i386 libgl1-mesa-dev:i386 libglu1-mesa-dev:i386 libxcursor-dev:i386 libxi-dev:i386 libxrandr-dev:i386 libxinerama-dev:i386 libxcomposite-dev:i386 libdbus-1-dev:i386 libgnutls-dev:i386 libncurses5-dev:i386 libsane-dev:i386 libv4l-dev:i386 libgphoto2-6-dev:i386 liblcms2-dev:i386 liblcms1-dev:i386 gstreamer0.10-plugins-base:i386 libcapi20-dev:i386 libcups2-dev:i386 libfontconfig1-dev:i386 libgsm1-dev:i386 libtiff5-dev:i386 libmpg123-dev:i386 libopenal-dev:i386 libxrender-dev:i386 libxml2-dev:i386 libxslt1-dev:i386 libpng12-dev:i386 libssl-dev:i386 libldap2-dev:i386 unixodbc-dev:i386
sudo apt-get -y build-dep wine1.7
cd /usr/lib/i386-linux-gnu
sudo ln -s libfreetype.so.6 libfreetype.so
sudo ln -s libOSMesa.so.6 libOSMesa.so
git clone git://source.winehq.org/git/wine.git ~/wine-git
cd ~/wine-git
cat "/home/krabica/Dokumenty/TextFiles/0099-EndlessSpace-WGL-ShareList-Hack.patch" | patch -p1
./configure
make
I warned you.
As you can see, this script calls several commands, some as root and some as the normal user, in this case "krabica" ("box" (as in "cardboard box") in english).
The problem is that it takes 2+ hours to compile Wine on my laptop, so want to leave it running while I go to sleep, but I want my laptop to turn off/sleep or anything (enter a state where the computer and the fan doesn't work, to save energy and let me sleep in silence).
The problem is the shutdown
must be called as sudo
, or it won't work. But, at the time the script finishes, the password is no longer in the cache, and you need to type it again (not very convinient when you're asleep).
I tried to run path/to/script && sudo shutdown
, but that didn't work either. It wants a password 15 minutes since you last typed it.
Is there any easy way to achieve this? By easy I mean not changing system settings, etc.
Thanks.
sudo
for this, look at this answer askubuntu.com/a/201327/265974