|
这个“自动安装脚本”算不上自动安装,是在装完基本系统后用来装xfce桌面环境以及更改相关的配置文件(sudo、xinit、inittab、useradd、slim.conf、rc.conf、etc.)的脚本
----------
在虚拟机和实体机上都试了下应该没错了
- #!/bin/bash
- # expected environment : freshly installed archlinux, login : root.
- echo "Are you connected to internet ? If not, please Ctrl+C and reload this script when connected"
- echo "Otherwise, press ENTER to continue installation"
- read var_dummy
- echo "Creation of the user : please type in your user name :"
- read var_username
- useradd -u 1000 -g users -G audio,lp,storage,optical,video,wheel,games,power,network -d /home/$var_username/ -s /bin/bash -m $var_username
- echo "You will now be asked to create the password for this user:"
- passwd $var_username
- # Add servers for pacman to find packages
- cat >> /etc/pacman.conf << EOF
- [multilib]
- Include = /etc/pacman.d/mirrorlist
- [archlinuxfr]
- Server = http://repo.archlinux.fr/`arch`
- EOF
- # Install packages
- pacman-db-upgrade
- pacman -Syyu
- pacman -S acpi acpid alsa-oss alsa-plugins alsa-utils cpufrequtils cups dbus gstreamer0.10-base-plugins iptables laptop-mode-tools mesa net-tools netcfg ntp pm-utils rfkill rsync sudo ttf-dejavu vim wireless_tools xf86-input-evdev xorg-server xorg-utils xorg-xinit xorg-xinput yaourt gamin gnome-icon-theme gnome-keyring gvfs-afc network-manager-applet networkmanager slim slim-themes archlinux-themes-slim hicolor-icon-theme xfce4 xfce4-goodies ttf-dejavu wqy-zenhei ffmpeg mplayer scrot
- # Fix sound issue
- cat > /home/$var_username/.asoundrc << EOF
- pcm.!default{
- type hw
- card 1
- device 0
- }
- ctl.!default{
- type hw
- card 1
- device 0
- }
- EOF
- chown $var_username:users /home/$var_username/.asoundrc
- # Configure video settings for X
- if [[ ! -e /etc/X11/xorg.conf.d ]]
- then
- mkdir /etc/X11/xorg.conf.d
- fi
- #i dont know how write you can write yourself
- echo "please type in your graphic card's type (intel,ati,nv,vesa,nouveau,vmware,...)"
- echo "I will use pacman -S xf86-video-<the type> to install the driver"
- read card_type
- pacman -S xf86-video-$card_type
- # Install clickpad support
- yaourt -S xf86-input-synaptics-clickpad
- # Add new daemons, remove old ones, disable hwclock and remove netfs since I don't use it. add it if you need it
- sed '/DAEMONS=/c\DAEMONS=(!hwclock dbus syslog-ng networkmanager !laptop-mode acpid @alsa @cupsd @cpufreq ntpd crond)' </etc/rc.conf >/etc/rc.conf.new
- mv -f /etc/rc.conf.new /etc/rc.conf
- # Slim login manager ; change theme
- mv /usr/share/slim/themes/archlinux-darch-grey /tmp/
- mv /usr/share/slim/themes/default /tmp/
- rm -r /usr/share/slim/themes/*
- mv /tmp/archlinux-darch-grey /usr/share/slim/themes
- mv /tmp/default /usr/share/slim/themes
- sed '/^current_theme/c\current_theme archlinux-darch-grey' </etc/slim.conf >/etc/slim.conf.new
- mv -f /etc/slim.conf.new /etc/slim.conf
- # XFCE login, and thunar launched as a daemon (note that the part with 'if [ -d /etc/X11/xinit/xinitrc.d ]" is not present, to avoid mounting problems when logged as regular user)
- cat >/home/$var_username/.xinitrc << EOF
- #!/bin/sh
- #
- # ~/.xinitrc
- #
- # Executed by startx (run your window manager from here)
- exec ck-launch-session startxfce4
- thunar --daemon &
- EOF
- chown $var_username:users /home/$var_username/.xinitrc
- # Boot to runlevel 5 now, and run slim then
- sed -e 's/id:3/#id:3/' -e 's/#id:5/id:5/' -e 's|x:5:respawn:/usr/bin/xdm|#x:5:respawn:/usr/bin/xdm|' -e 's|#x:5:respawn:/usr/bin/slim|x:5:respawn:/usr/bin/slim|' </etc/inittab >/etc/inittab.new
- mv -f /etc/inittab.new /etc/inittab
- # add user to sudoers,and the sudo poweroff without password
- sed -e "/^root/a $var_username ALL=(ALL) ALL" -e "/^root/a $var_username ALL=(ALL) NOPASSWD : /sbin/poweroff " </etc/sudoers >/etc/sudoers.new
- mv -f /etc/sudoers.new /etc/sudoers
- chmod 0440 /etc/sudoers
- # Reboot, because it's quick and I'm too lazy to learn how to start all the daemons and others.
- reboot
复制代码
还有cpufreq那部分没写,xorg.d那个目录也没写让他自动检测吧,会写的帮忙写吧
中文本地化脚本在5楼。
。
pm_utils 使用见wiki :https://wiki.archlinux.org/index.php/Pm-utils
求完善 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|