logo

한국어
#!/bin/sh

echo "###########################################################"
echo "#"
echo "# openwrt adduser"
echo "#"
echo "###########################################################"
echo ""
echo "chroot_local_user=YES" >> /etc/vsftpd.conf
echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf
echo "openwrt:x:500:65534:openwrt:/mnt:/bin/false" >> /etc/passwd
echo "openwrt:x:0:0:99999:7:::" >> /etc/shadow
chown -R openwrt:nogroup /mnt

echo "###########################################################"
echo "#"
echo "# /etc/hotplug.d/block/10-mount"
echo "#"
echo "###########################################################"
echo ""
echo "#!/bin/sh" > /etc/hotplug.d/block/10-mount
echo "" >> /etc/hotplug.d/block/10-mount
echo "# Copyright (C) 2011 OpenWrt.org" >> /etc/hotplug.d/block/10-mount
echo "" >> /etc/hotplug.d/block/10-mount
echo "# more apps installed, need more time to load kernel modules!" >> /etc/hotplug.d/block/10-mount
echo "sleep 5" >> /etc/hotplug.d/block/10-mount
echo "blkdev=\`dirname \$DEVPATH\`" >> /etc/hotplug.d/block/10-mount
echo "if [ \`basename \$blkdev\` != \"block\" ]; then" >> /etc/hotplug.d/block/10-mount
echo "  device=\`basename \$DEVPATH\`" >> /etc/hotplug.d/block/10-mount
echo "  case \"\$ACTION\" in" >> /etc/hotplug.d/block/10-mount
echo "    add)" >> /etc/hotplug.d/block/10-mount
echo "      mkdir -p /mnt" >> /etc/hotplug.d/block/10-mount
echo "      # vfat & ntfs-3g check" >> /etc/hotplug.d/block/10-mount
echo "      if [ \`which fdisk\` ]; then" >> /etc/hotplug.d/block/10-mount
echo "        isntfs=\`fdisk -l | grep \$device | grep NTFS\`" >> /etc/hotplug.d/block/10-mount
echo "        isvfat=\`fdisk -l | grep \$device | grep FAT\`" >> /etc/hotplug.d/block/10-mount
echo "        isfuse=\`lsmod | grep fuse\`" >> /etc/hotplug.d/block/10-mount
echo "        isntfs3g=\`which ntfs-3g\`" >> /etc/hotplug.d/block/10-mount
echo "      else" >> /etc/hotplug.d/block/10-mount
echo "        isntfs=\"\"" >> /etc/hotplug.d/block/10-mount
echo "        isvfat=\"\"" >> /etc/hotplug.d/block/10-mount
echo "      fi" >> /etc/hotplug.d/block/10-mount
echo "" >> /etc/hotplug.d/block/10-mount
echo "      # mount with ntfs-3g if possible, else with default mount" >> /etc/hotplug.d/block/10-mount
echo "      if [ \"\$isntfs\" -a \"\$isfuse\" -a \"\$isntfs3g\" ]; then" >> /etc/hotplug.d/block/10-mount
echo "        ntfs-3g -o rw,sync,uid=500,gid=65534,locale=ko_KR.UTF-8 /dev/\$device /mnt" >> /etc/hotplug.d/block/10-mount
echo "      elif [ \"\$isvfat\" ]; then" >> /etc/hotplug.d/block/10-mount
echo "        mount -o rw,uid=500,gid=65534,codepage=949,iocharset=utf8 /dev/\$device /mnt" >> /etc/hotplug.d/block/10-mount
echo "      else" >> /etc/hotplug.d/block/10-mount
echo "        mount -o rw,sync,uid=500,gid=65534,locale=ko_KR.UTF-8 /dev/\$device /mnt" >> /etc/hotplug.d/block/10-mount
echo "      fi" >> /etc/hotplug.d/block/10-mount
echo "      ;;" >> /etc/hotplug.d/block/10-mount
echo "    remove)" >> /etc/hotplug.d/block/10-mount
echo "      umount -l /dev/\$device" >> /etc/hotplug.d/block/10-mount
echo "      ;;" >> /etc/hotplug.d/block/10-mount
echo "  esac" >> /etc/hotplug.d/block/10-mount
echo "fi" >> /etc/hotplug.d/block/10-mount

echo "###########################################################"
echo "#"
echo "# passwd openwrt"
echo "#"
echo "###########################################################"
echo ""
passwd openwrt

echo ""
echo "###########################################################"
echo "#"
echo "# smbpasswd -a openwrt"
echo "#"
echo "###########################################################"
echo ""
smbpasswd -a openwrt

echo ""
echo "###########################################################"
echo "#"
echo "# PLEASE, REBOOT NOW"
echo "#"
echo "###########################################################"
echo ""