#!/bin/sh NAME="init1-PLC" checkNeedMod=0 # set release name echo "ALTLinux T6 PLC" > /etc/altlinux-release # replace inittab #mv -f -- /etc/inittab.plc /etc/inittab # stage1 need this #mkdir -p /image # set root password # echo "root:\$2a\$08\$dBejTFwbEeeLLwoTjgkPU.NQ7FG/Vln4DCscIPQubM4akrxdn38wa:14792::::::" > /etc/tcb/root/shadow # "123456" # echo "root:\$2y\$08\$GDLsgZPn7CyXvid.flGkIeHiYEGdXFkRoheNZACbxONp7xPDO0mGa:15690::::::" > /etc/tcb/root/shadow # "root" echo "root::15690::::::" > /etc/tcb/root/shadow # "" # useradd admin -g adm -G wheel,disk # echo "admin:\$2a\$08\$qGjau56.16CvipkuVhNe/.IXfMnLZWRLFYPpxGRLQmdlnndAH9Dom:14792::::::" > /etc/tcb/admin/shadow # Allow root access to ssh echo "PermitRootLogin yes" >> /etc/openssh/sshd_config # set /etc/fstab # echo "proc /proc proc nosuid,noexec,gid=proc 0 0" > /etc/fstab # echo "devpts /dev/pts devpts nosuid,noexec,gid=tty,mode=620 0 0" >> /etc/fstab # echo "shmfs /dev/shm tmpfs nosuid 0 0" >> /etc/fstab # echo "tmpfs /tmp tmpfs nosuid 0 0" >> /etc/fstab # set locale echo "LANG=en_US.UTF-8" > /etc/sysconfig/i18n echo "SUPPORTED=uk_UA:ru_RU:en_US" >> /etc/sysconfig/i18n # set default network subst 's/LINKDETECT=auto/LINKDETECT=no/' /etc/net/ifaces/default/options-eth subst 's/USE_IFPLUGD=yes/USE_IFPLUGD=no/' /etc/net/ifaces/default/options-eth ## Init ETH0 if_name=eth0 if [ ! -e /etc/net/ifaces/${if_name} ]; then mkdir /etc/net/ifaces/${if_name}; fi echo "TYPE=eth" > /etc/net/ifaces/${if_name}/options echo "ONBOOT=yes" >> /etc/net/ifaces/${if_name}/options echo "BOOTPROTO=dhcp-static" >> /etc/net/ifaces/${if_name}/options echo "DISABLED=no" >> /etc/net/ifaces/${if_name}/options echo "192.168.0.1/24" > /etc/net/ifaces/${if_name}/ipv4address echo "127.0.0.1 localhost" > /etc/hosts echo > /etc/resolv.conf # set clock echo > /etc/adjtime echo "UTC=\"true\"" > /etc/sysconfig/clock echo "ZONE=\"Europe/Kiev\"" >> /etc/sysconfig/clock rm -f /etc/localtime cp /usr/share/zoneinfo/Europe/Kiev /etc/localtime rm -rf /usr/share/zoneinfo # init services chkconfig oscadad on #remove all docs, license and icons rm -rf /usr/share/{doc,man,info} #rm -rf /usr/share/{license,gfxboot,icons} # remove rpm db and apt data files #rm -rf /var/lib/rpm/* #rm -rf /var/cache/apt /var/lib*/apt # remove unneeded translations for i in /usr/share/locale/*; do if [ ${i##*/} != "en" ] && [ ${i##*/} != "ru" ] && [ ${i##*/} != "uk" ]; then rm -rf ${i}; fi; done # remove unneeded locales for i in `find /usr/lib/locale -mindepth 1 -maxdepth 1 -type d \! -name 'en_US*' -a \! -name 'ru_RU*' -a \! -name '*_UA*'`; do rm -rf ${i}; done # run depmod if [ $checkNeedMod = 1 ]; then for i in /lib*/modules/*; do #remove modules k_mod=/lib/modules/${i##*/} k_dir=${k_mod}/kernel c_dir=${k_mod}/choosing if [ ! -e ${c_dir} ]; then mkdir ${c_dir} -m 0755; fi if [ -e ${k_dir} ]; then # Copy need drivers # Generic modLs="evdev ff-memless dm-mod dm-multipath serio_raw rng-core aes-* aes_* rtc crc* ac button i2c-core i2c-dev hwmon hwmon-vid softdog loop sg scsi_mod scsi_* sd_mod ata_generic pata_acpi libata ext2 ext3 vfat fat jbd mbcache squashfs zlib_inflate nls_* af_packet mii e100 via-rhine bridge stp usb* *-hcd hid hid-* libusual" # PLX8 #modLs="$modLs dscudkp cs5535_gpio geode-rng pata_cs5536 pata_amd w83627*" # LP-8781 modLs="$modLs slot ipic cs5535_gpio geode-* pata_cs5536 pata_amd it87 lxfb" modLs="$modLs ide-* rtc-*" # for old kernel for kf in $modLs; do fr=`find ${k_dir} -name ${kf}.ko` # if [ $fr ]; then cp ${fr} ${c_dir}; fi; for kfi in $fr; do cp -f ${kfi} ${c_dir}; done done # Remove left drivers rm -rf ${k_dir} fi /sbin/depmod -a -F /boot/System.map-${i##*/} ${i##*/} done fi # remove image's boot directory rm -rf /boot # remove ogfs rm -f /lib*/evms/*/ogfs* # udev needed this ln -sf /proc/mounts /etc/mtab # enable portmap # chkconfig portmap on # sed -i 's,#\(PORTMAP_ARGS="-l".*\),\1,' /etc/sysconfig/portmap