diff options
Diffstat (limited to 'abs')
-rwxr-xr-x | abs/core-testing/live-installer/PKGBUILD | 5 | ||||
-rwxr-xr-x | abs/core-testing/live-installer/install_proxy.sh | 82 | ||||
-rw-r--r-- | abs/core-testing/live-installer/myth_user_call | 164 |
3 files changed, 230 insertions, 21 deletions
diff --git a/abs/core-testing/live-installer/PKGBUILD b/abs/core-testing/live-installer/PKGBUILD index ae65049..c9ff10c 100755 --- a/abs/core-testing/live-installer/PKGBUILD +++ b/abs/core-testing/live-installer/PKGBUILD @@ -1,11 +1,11 @@ pkgname=live-installer pkgver=1.0 -pkgrel=38 +pkgrel=44 pkgdesc="Install and configure your system" depends=(bc libstatgrab mysql-python expect curl dnsutils parted sg3_utils) arch=('i686') -source=(mythinstall.bin file_time_offset.py install-ui.xml install_proxy.sh install_functions.sh systemconfig.sh install_db_chroot.sh restore_default_settings.sh xconfig.sh timezip.py soundconfig.sh LinHES-release issue MythVantage.sh create_master.sh build_diskless.sh networkconfig.sh ) +source=(mythinstall.bin myth_user_call file_time_offset.py install-ui.xml install_proxy.sh install_functions.sh systemconfig.sh install_db_chroot.sh restore_default_settings.sh xconfig.sh timezip.py soundconfig.sh LinHES-release issue MythVantage.sh create_master.sh build_diskless.sh networkconfig.sh ) install=live.install @@ -22,6 +22,7 @@ build() { #copy in all the installer specific stuff rsync -r --exclude=.svn ../templates $MVDIR/ + install -m0700 myth_user_call $MVDIR/bin/myth_user_call install -m 0755 install_proxy.sh $MVDIR/bin/install_proxy.sh install -m 0755 install_functions.sh $MVDIR/bin/install_functions.sh install -m 0755 systemconfig.sh $MVDIR/bin/systemconfig.sh diff --git a/abs/core-testing/live-installer/install_proxy.sh b/abs/core-testing/live-installer/install_proxy.sh index cd5bb31..f39b3d4 100755 --- a/abs/core-testing/live-installer/install_proxy.sh +++ b/abs/core-testing/live-installer/install_proxy.sh @@ -31,6 +31,26 @@ fi } +function apply_new_auth () { +#check if file is present + if [ -f /root/myth_user_call.out ] + then + #read in file, running each command in chroot + exec 4</root/myth_user_call.out + while read LINE <&4 + do + if [ ! x"$LINE" = x ] + then + #run commands in chroot + chroot "$mountpoint" $MV_ROOT/bin/myth_user_call -i $LINE > /tmp/user_auth.update + fi + done + rm -f /root/myth_user_call.out + else + echo "No new password changes to apply" + fi +} + @@ -87,7 +107,8 @@ full_install () { cp -f $MV_ROOT/bin/*.sh "$mountpoint"$MV_ROOT/bin/ chmod -R 755 ${mountpoint}/root cp /etc/mtab "$mountpoint"/etc/mtab - + apply_new_auth + if [ $SystemType = "Master_backend" -o $SystemType = "Standalone" ] then @@ -100,7 +121,7 @@ full_install () { echo "stopping mysql in chroot" chroot "$mountpoint" /etc/rc.d/mysqld stop umount "$mountpoint/dev" - + #/etc/rc.d/mysqld start else #update remotedb with this host settings @@ -125,7 +146,7 @@ full_install () { function createsquashlist(){ if [ -f $1 ] then - rm -f + rm -f $1 fi for i in bin boot etc home lib opt root sbin usr var @@ -169,7 +190,7 @@ function upgrade () { cp -fp /new_boot/etc.old/ssh/*.pub /new_boot/etc/ssh/ cp -fp /new_boot/etc.old/ssh/*.key /new_boot/etc/ssh/ cp -fp /new_boot/etc.old/ssh/*key /new_boot/etc/ssh/ - + #funckeys cadir=/etc/pki/func/ca mv /new_boot/etc/pki /new_boot/etc/pki.new @@ -184,9 +205,9 @@ function upgrade () { #rootfs=`grep ${disk}1 /tmp/etc/fstab |awk ' { print $3 } '` rootfs=`grep \/\ /tmp/etc/fstab |awk ' { print $3 } '` fi - #datafs=`grep ${disk}3 /tmp/etc/fstab |awk ' { print $3 } '` - datafs=`grep \/data /tmp/etc/fstab |awk ' { print $3 } '` - $run fstab_fix_it $disk $rootfs $datafs UPGRADE +# #datafs=`grep ${disk}3 /tmp/etc/fstab |awk ' { print $3 } '` +# datafs=`grep \/data /tmp/etc/fstab |awk ' { print $3 } '|head 1` + $run fstab_fix_it $disk UPGRADE echo "Writing boot sector" > /tmp/.install_state progress 99 @@ -203,6 +224,10 @@ function upgrade () { chmod -R 755 ${mountpoint}/root chown root:mythtv "$mountpoint"/etc/systemconfig chmod 775 "$mountpoint"/etc/systemconfig + #mount /proc and /dev + mount --bind /dev "$mountpoint/dev" + mount --bind /proc "$mountpoint/proc" + chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,this_is_install #wrap this in a network check_network, no need to update the db if the import worked. ##### do I need to start mysql? @@ -212,11 +237,11 @@ function upgrade () { #Run second time chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,this_is_install chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh advanced,this_is_install - - # fi - + umount "$mountpoint/dev" + umount "$mountpoint/proc" echo "Done" > /tmp/.install_state cp /tmp/mythvantage_install.log $mountpoint/var/log/ + $run unmount_it $disk } @@ -267,7 +292,7 @@ ip address flush dev eth0 # echo "using netboot" # USEVNC=0 # fi -# +# # else # echo " using vnc" # fi @@ -280,7 +305,7 @@ ip address flush dev eth0 # then # exit 1 # fi -# +# # if [ ! x$USEVNC = x0 ] # then # echo "Resetting the network" @@ -298,17 +323,17 @@ ip address flush dev eth0 # echo "nameserver $nameserver" > /etc/resolv.conf # return 0 # fi -# +# # if [ $UseDHCP = 1 ] # then -# +# # /sbin/ifconfig $DEVICE $ip # /sbin/route add default gw $route # echo "nameserver $nameserver" > /etc/resolv.conf -# +# # fi -# -# +# +# # } function SANE_SYSETTINGS () { @@ -422,11 +447,30 @@ echo "-----------------------------------------------------------------------3-- fi ;; host_names) - host $hostname - if [ $? = 0 ] + #if host is found, then check to see if it's online + #if not online, assume it's ok to use this hostname + + hout=`host $hostname` + status=$? + #found host, now grab the ip + if [ $status = 0 ] + then + hoip=`echo $hout|awk '{print $4}'` + ping -c 1 $hoip + if [ $? = 0 ] + then + status=0 + else + status=1 + fi + fi + + if [ $status = 0 ] then exit 7 fi + + ;; esac diff --git a/abs/core-testing/live-installer/myth_user_call b/abs/core-testing/live-installer/myth_user_call new file mode 100644 index 0000000..ac97705 --- /dev/null +++ b/abs/core-testing/live-installer/myth_user_call @@ -0,0 +1,164 @@ +#!/bin/bash +#Wrapper script to manage USERNAME accounts + web security +# myth_USERNAME_all -c add -u USERNAME +# myth_USERNAME_all -c delete -u USERNAME +# myth_USERNAME_all -c pass -u USERNAME -p pass +# myth_USERNAME_all -c web -u USERNAME -p pass + +INIT_CHECK=TRUE +FULL_CALL="$@" +function CHROOT_CHECK { + INIT=`ps -p 1 -o comm=` + if [ x$INIT = xrunit ] + then + CHROOT_NEEDED=FALSE + else + CHROOT_NEEDED=TRUE + fi +} + +function store_commands () { + echo "$FULL_CALL" >> /root/myth_user_call.out + chmod 600 /root/myth_user_call.out +} + + +function add_user() { + if [ $CHROOT_NEEDED = TRUE ] + then + echo "calling myth_call_user in chroot to add user" + store_commands + else + echo "adding user $USERNAME" + useradd $USERNAME + fi + +} + + +function del_user() { + if [ $CHROOT_NEEDED = TRUE ] + then + echo "calling myth_call_user in chroot to delete user" + store_commands + else + echo "removing user $USERNAME" + userdel $USERNAME + fi + +} + + +function pass_change() { + if [ $CHROOT_NEEDED = TRUE ] + then + echo "calling myth_call_user in chroot to change password" + store_commands + else + echo "changing password for $USERNAME" + echo $USERNAME:$PASSWORD | chpasswd + fi + +} + + +function web_security { + echo "this is just a stub" + +} + +function ARG_ERR() { + if [ x$OPTARG = "x" ] + then + echo "$SWITCH NEEDS AND ARG" + exit 11 + fi +} + + +function print_help { + + echo "Valid options are:" + echo " -c (add|delete|pass|web)" + echo " -u USERNAMEname" + echo " -p password" + exit 1 +} + +if [ $# -eq 0 ] +then + print_help +fi + +declare -r OPTSTRING="c:u:p:i" +while getopts "$OPTSTRING" SWITCH +do + case $SWITCH in + + c) ARG_ERR + OPERATION=$OPTARG + ;; + u) ARG_ERR + USERNAME=$OPTARG + ;; + p) ARG_ERR + PASSWORD=$OPTARG + ;; + i) INIT_CHECK=FALSE + + esac +done + +if [ $INIT_CHECK = TRUE ] +then + CHROOT_CHECK +else + CHROOT_NEEDED=FALSE +fi + +case $OPERATION in + add) + if [ x$USERNAME = x ] + then + print_help + fi + add_user + ;; + delete) + if [ x$USERNAME = x ] + then + print_help + fi + del_user + ;; + pass) + if [ x$USERNAME = x ] + then + print_help + fi + + if [ x$PASSWORD = x ] + then + print_help + fi + pass_change + ;; + + web) + if [ x$USERNAME = x ] + then + print_help + fi + + + if [ x$PASSWORD = x ] + then + print_help + fi + echo "adding webUSERNAME $USERNAME with $PASS" + ;; + *) print_help + ;; +esac + + |