-
Notifications
You must be signed in to change notification settings - Fork 1
/
Lazybuntu
executable file
·61 lines (48 loc) · 2.06 KB
/
Lazybuntu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Startup script of Lazybuntu
# License: GNU GPL
# 避開 8.04 gksudo env_reset 的問題
mkdir -p temp
ENV_EXPORT_SCRIPT="temp/env-export.sh"
touch "$ENV_EXPORT_SCRIPT"
chmod a+x "$ENV_EXPORT_SCRIPT"
echo "#!/bin/bash" > "$ENV_EXPORT_SCRIPT"
DIR=`dirname $0`
cd "$DIR"
# Export distribution codename (gutsy, feisty, ...etc)
echo "export DISTRIB_CODENAME=`lsb_release -cs`" >> "$ENV_EXPORT_SCRIPT"
# Export architecture as ARCH_NAME (i686,x86_64, ...etc)
export ARCH_NAME="`uname -a | cut -d " " -f 12`"
echo "export ARCH_NAME=\"`uname -a | cut -d " " -f 12`\"" >> $ENV_EXPORT_SCRIPT
# Export dustribution ID (Debian or Ubuntu)
echo "export DISTRIB_ID=`lsb_release -is`" >> "$ENV_EXPORT_SCRIPT"
# check the path of desktop dir
XDG_USER_DIRS=~/.config/user-dirs.dirs
if [ -f "$XDG_USER_DIRS" ]; then
. ~/.config/user-dirs.dirs
fi
if [ -z "$XDG_DESKTOP_DIR" ]; then
export DESKTOP_DIR=$HOME/Desktop
echo "export DESKTOP_DIR=\"$HOME/Desktop\"" >> $ENV_EXPORT_SCRIPT
else
export DESKTOP_DIR=$XDG_DESKTOP_DIR
echo "export DESKTOP_DIR=\"$XDG_DESKTOP_DIR\"" >> $ENV_EXPORT_SCRIPT
fi
# Ensure there is a desktop dir, if this doesn't exist, that's a bug of ubuntu.
if [ ! -e "$DESKTOP_DIR" ]; then
mkdir -p "$DESKTOP_DIR"
fi
# symlink desktop dir to ~/Desktop for compatibility
if [ "$DESKTOP_DIR" != "$HOME/Desktop" -a ! -e "$HOME/Desktop" ]; then
ln -s "$DESKTOP_DIR" "$HOME/Desktop"
fi
# Preserve the user name
export REAL_USER="$USER"
export REAL_HOME="$HOME"
echo "export REAL_USER=\"$USER\"" >> $ENV_EXPORT_SCRIPT
echo "export REAL_HOME=\"$HOME\"" >> $ENV_EXPORT_SCRIPT
# wget command used to download files
export WGET="wget --tries=2 --timeout=120 -c"
echo "export WGET=\"wget --tries=2 --timeout=120 -c\"" >> $ENV_EXPORT_SCRIPT
# run Lazybuntu with root access
gksudo --message "執行 'Lazybuntu 懶人包' 會修改系統設定,並會安裝新軟體,所以需要系統管理員權限。 請輸入系統管理密碼,才能繼續執行。 (在 Ubuntu 下,預設這就是你登入系統時所用的密碼。)" --preserve-env ui/Lazybuntu.py